<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.cecep.talroad.mapper.PcLabelValueMapper">

    <resultMap type="cn.cecep.talroad.domain.PcLabelValue" id="PcLabelValueResult">
        <result property="id"    column="id"    />
        <result property="labelId"    column="label_id"    />
        <result property="argumentsCode"    column="arguments_code"    />
        <result property="argumentsName"    column="arguments_name"    />
        <result property="argumentsMultipleChoice"    column="arguments_multiple_choice"    />
    </resultMap>


    <sql id="selectPcLabelValueVo">
        select id, label_id, arguments_code, arguments_name, arguments_multiple_choice from pc_label_value
    </sql>

    <select id="selectPcLabelValueList" parameterType="cn.cecep.talroad.domain.PcLabelValue" resultMap="PcLabelValueResult">
        <include refid="selectPcLabelValueVo"/>
        <where>
            <if test="labelId != null  and labelId != ''"> and label_id = #{labelId}</if>
            <if test="argumentsCode != null  and argumentsCode != ''"> and arguments_code = #{argumentsCode}</if>
            <if test="argumentsName != null  and argumentsName != ''"> and arguments_name like concat('%', #{argumentsName}, '%')</if>
            <if test="argumentsMultipleChoice != null  and argumentsMultipleChoice != ''"> and arguments_multiple_choice = #{argumentsMultipleChoice}</if>
        </where>
    </select>
    <insert id="batchSave">
        INSERT INTO public.pc_label_value (id, label_id, arguments_code, arguments_name, order_num) VALUES
        <foreach collection="addList" separator="," item="item">
            (#{item.id}, #{item.labelId}, #{item.argumentsCode}, #{item.argumentsName}, #{item.orderNum})
        </foreach>
    </insert>
</mapper>
