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

    <select id="selectSKcKnRefillsheetList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_refillsheet where 1=1
        <if test="refillSheetNumber !=null and refillSheetNumber !='' ">
            and refillSheetNumber = #{refillSheetNumber}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="batch !=null and batch !='' ">
            and batch = #{batch}
        </if>
        <if test="refillQuantity !=null and refillQuantity !='' ">
            and refillQuantity = #{refillQuantity}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
    </select>


    <update id="updateSKcKnRefillsheet" parameterType="pd" >
        update s_kc_kn_refillsheet
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="refillSheetNumber !=null and refillSheetNumber !='' ">
            refillSheetNumber = #{refillSheetNumber},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
            batch = #{batch},
        </if>
        <if test="refillQuantity !=null and refillQuantity !='' ">
            refillQuantity = #{refillQuantity},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="refillSheetNumber !=null and refillSheetNumber !='' ">
            refillSheetNumber,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="batch !=null and batch !='' ">
            batch,
        </if>
        <if test="refillQuantity !=null and refillQuantity !='' ">
            refillQuantity,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="refillSheetNumber !=null and refillSheetNumber !='' ">
             #{refillSheetNumber},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
             #{batch},
        </if>
        <if test="refillQuantity !=null and refillQuantity !='' ">
             #{refillQuantity},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        </trim>

    </insert>

</mapper>
