<?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="com.ruoyi.nanjing.mapper.TRpBarcoderelationshipMapper">

    <resultMap type="TRpBarcoderelationship" id="TRpBarcoderelationshipResult">
        <result property="ID"    column="ID"    />
        <result property="semiBarcode"    column="SemiBarcode"    />
        <result property="productBarcode"    column="ProductBarcode"    />
        <result property="semibarcodeLine"    column="SemiBarcode_Line"    />
        <result property="lineID"    column="LineID"    />
        <result property="stateFlag"    column="StateFlag"    />
        <result property="insertTime"    column="InsertTime"    />
    </resultMap>

    <sql id="selectTRpBarcoderelationshipVo">
        select ID, SemiBarcode, ProductBarcode, SemiBarcode_Line, LineID, StateFlag, InsertTime from T_RP_BarcodeRelationShip
    </sql>

    <select id="selectTRpBarcoderelationshipList" parameterType="TRpBarcoderelationship" resultMap="TRpBarcoderelationshipResult">
        <include refid="selectTRpBarcoderelationshipVo"/>
        <where>
            <if test="semiBarcode != null  and semiBarcode != ''"> and SemiBarcode = #{semiBarcode}</if>
            <if test="productBarcode != null  and productBarcode != ''"> and ProductBarcode = #{productBarcode}</if>
            <if test="semibarcodeLine != null  and semibarcodeLine != ''"> and SemiBarcode_Line = #{semibarcodeLine}</if>
            <if test="lineID != null "> and LineID = #{lineID}</if>
            <if test="stateFlag != null  and stateFlag != ''"> and StateFlag = #{stateFlag}</if>
            <if test="insertTime != null "> and InsertTime = #{insertTime}</if>
        </where>
    </select>

    <select id="selectTRpBarcoderelationshipById" parameterType="Long" resultMap="TRpBarcoderelationshipResult">
        <include refid="selectTRpBarcoderelationshipVo"/>
        where ID = #{ID}
    </select>

    <insert id="insertTRpBarcoderelationship" parameterType="TRpBarcoderelationship">
        insert into T_RP_BarcodeRelationShip
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ID != null">ID,</if>
            <if test="semiBarcode != null">SemiBarcode,</if>
            <if test="productBarcode != null">ProductBarcode,</if>
            <if test="semibarcodeLine != null">SemiBarcode_Line,</if>
            <if test="lineID != null">LineID,</if>
            <if test="stateFlag != null">StateFlag,</if>
            <if test="insertTime != null">InsertTime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ID != null">#{ID},</if>
            <if test="semiBarcode != null">#{semiBarcode},</if>
            <if test="productBarcode != null">#{productBarcode},</if>
            <if test="semibarcodeLine != null">#{semibarcodeLine},</if>
            <if test="lineID != null">#{lineID},</if>
            <if test="stateFlag != null">#{stateFlag},</if>
            <if test="insertTime != null">#{insertTime},</if>
         </trim>
    </insert>

    <update id="updateTRpBarcoderelationship" parameterType="TRpBarcoderelationship">
        update T_RP_BarcodeRelationShip
        <trim prefix="SET" suffixOverrides=",">
            <if test="semiBarcode != null">SemiBarcode = #{semiBarcode},</if>
            <if test="productBarcode != null">ProductBarcode = #{productBarcode},</if>
            <if test="semibarcodeLine != null">SemiBarcode_Line = #{semibarcodeLine},</if>
            <if test="lineID != null">LineID = #{lineID},</if>
            <if test="stateFlag != null">StateFlag = #{stateFlag},</if>
            <if test="insertTime != null">InsertTime = #{insertTime},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTRpBarcoderelationshipById" parameterType="Long">
        delete from T_RP_BarcodeRelationShip where ID = #{ID}
    </delete>

    <delete id="deleteTRpBarcoderelationshipByIds" parameterType="String">
        delete from T_RP_BarcodeRelationShip where ID in
        <foreach item="ID" collection="array" open="(" separator="," close=")">
            #{ID}
        </foreach>
    </delete>

</mapper>
