<?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="SKcBbRefillingitemsMapper" >
    <!-- 通用查询映射结果 -->

    <select id="selectSKcBbRefillingitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_refillingitems where 1=1
        <if test="refillingDate !=null and refillingDate !='' ">
            and refillingDate = #{refillingDate}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="refillingDocumentNumber !=null and refillingDocumentNumber !='' ">
            and refillingDocumentNumber = #{refillingDocumentNumber}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="refillingQuantity !=null and refillingQuantity !='' ">
            and refillingQuantity = #{refillingQuantity}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="qualityStatus !=null and qualityStatus !='' ">
            and qualityStatus = #{qualityStatus}
        </if>
        <if test="refiller !=null and refiller !='' ">
            and refiller = #{refiller}
        </if>
        <if test="verifier !=null and verifier !='' ">
            and verifier = #{verifier}
        </if>
    </select>


    <update id="updateSKcBbRefillingitems" parameterType="pd" >
        update s_kc_bb_refillingitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="refillingDate !=null and refillingDate !='' ">
            refillingDate = #{refillingDate},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="refillingDocumentNumber !=null and refillingDocumentNumber !='' ">
            refillingDocumentNumber = #{refillingDocumentNumber},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="refillingQuantity !=null and refillingQuantity !='' ">
            refillingQuantity = #{refillingQuantity},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="qualityStatus !=null and qualityStatus !='' ">
            qualityStatus = #{qualityStatus},
        </if>
        <if test="refiller !=null and refiller !='' ">
            refiller = #{refiller},
        </if>
        <if test="verifier !=null and verifier !='' ">
            verifier = #{verifier},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SKcBbRefillingitemsRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_kc_bb_refillingitems where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addSKcBbRefillingitems" parameterType="pd" >

        insert into s_kc_bb_refillingitems
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">

        <if test="refillingDate !=null and refillingDate !='' ">
            refillingDate,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="refillingDocumentNumber !=null and refillingDocumentNumber !='' ">
            refillingDocumentNumber,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="refillingQuantity !=null and refillingQuantity !='' ">
            refillingQuantity,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="qualityStatus !=null and qualityStatus !='' ">
            qualityStatus,
        </if>
        <if test="refiller !=null and refiller !='' ">
            refiller,
        </if>
        <if test="verifier !=null and verifier !='' ">
            verifier,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="refillingDate !=null and refillingDate !='' ">
             #{refillingDate},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="refillingDocumentNumber !=null and refillingDocumentNumber !='' ">
             #{refillingDocumentNumber},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="refillingQuantity !=null and refillingQuantity !='' ">
             #{refillingQuantity},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="qualityStatus !=null and qualityStatus !='' ">
             #{qualityStatus},
        </if>
        <if test="refiller !=null and refiller !='' ">
             #{refiller},
        </if>
        <if test="verifier !=null and verifier !='' ">
             #{verifier},
        </if>
        </trim>

    </insert>

</mapper>
