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

    <select id="selectSKcBbQdjlCleaningitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_qdjl_cleaningitems where 1=1
        <if test="cleaningDate !=null and cleaningDate !='' ">
            and cleaningDate = #{cleaningDate}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="cleaningDocumentNumber !=null and cleaningDocumentNumber !='' ">
            and cleaningDocumentNumber = #{cleaningDocumentNumber}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="quantityBeforeCleaning !=null and quantityBeforeCleaning !='' ">
            and quantityBeforeCleaning = #{quantityBeforeCleaning}
        </if>
        <if test="quantityAfterCleaning !=null and quantityAfterCleaning !='' ">
            and quantityAfterCleaning = #{quantityAfterCleaning}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="cleaner !=null and cleaner !='' ">
            and cleaner = #{cleaner}
        </if>
    </select>


    <update id="updateSKcBbQdjlCleaningitems" parameterType="pd" >
        update s_kc_bb_qdjl_cleaningitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="cleaningDate !=null and cleaningDate !='' ">
            cleaningDate = #{cleaningDate},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="cleaningDocumentNumber !=null and cleaningDocumentNumber !='' ">
            cleaningDocumentNumber = #{cleaningDocumentNumber},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="quantityBeforeCleaning !=null and quantityBeforeCleaning !='' ">
            quantityBeforeCleaning = #{quantityBeforeCleaning},
        </if>
        <if test="quantityAfterCleaning !=null and quantityAfterCleaning !='' ">
            quantityAfterCleaning = #{quantityAfterCleaning},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="cleaner !=null and cleaner !='' ">
            cleaner = #{cleaner},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="cleaningDate !=null and cleaningDate !='' ">
            cleaningDate,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="cleaningDocumentNumber !=null and cleaningDocumentNumber !='' ">
            cleaningDocumentNumber,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="quantityBeforeCleaning !=null and quantityBeforeCleaning !='' ">
            quantityBeforeCleaning,
        </if>
        <if test="quantityAfterCleaning !=null and quantityAfterCleaning !='' ">
            quantityAfterCleaning,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="cleaner !=null and cleaner !='' ">
            cleaner,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="cleaningDate !=null and cleaningDate !='' ">
             #{cleaningDate},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="cleaningDocumentNumber !=null and cleaningDocumentNumber !='' ">
             #{cleaningDocumentNumber},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="quantityBeforeCleaning !=null and quantityBeforeCleaning !='' ">
             #{quantityBeforeCleaning},
        </if>
        <if test="quantityAfterCleaning !=null and quantityAfterCleaning !='' ">
             #{quantityAfterCleaning},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="cleaner !=null and cleaner !='' ">
             #{cleaner},
        </if>
        </trim>

    </insert>

</mapper>
