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

    <select id="selectSKcBbProductinspectionList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_productinspection where 1=1
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="inspectionDocumentNumber !=null and inspectionDocumentNumber !='' ">
            and inspectionDocumentNumber = #{inspectionDocumentNumber}
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            and dosageForm = #{dosageForm}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="barcode !=null and barcode !='' ">
            and barcode = #{barcode}
        </if>
        <if test="businessScope !=null and businessScope !='' ">
            and businessScope = #{businessScope}
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
            and approvalNumber = #{approvalNumber}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="batch !=null and batch !='' ">
            and batch = #{batch}
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
            and inspectionDate = #{inspectionDate}
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            and productionDate = #{productionDate}
        </if>
        <if test="validityPeriod !=null and validityPeriod !='' ">
            and validityPeriod = #{validityPeriod}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="supplier !=null and supplier !='' ">
            and supplier = #{supplier}
        </if>
        <if test="arrivalQuantity !=null and arrivalQuantity !='' ">
            and arrivalQuantity = #{arrivalQuantity}
        </if>
        <if test="inspectionQualifiedQuantity !=null and inspectionQualifiedQuantity !='' ">
            and inspectionQualifiedQuantity = #{inspectionQualifiedQuantity}
        </if>
        <if test="costPrice !=null and costPrice !='' ">
            and costPrice = #{costPrice}
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            and costAmount = #{costAmount}
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            and sapDeliveryDocumentNumber = #{sapDeliveryDocumentNumber}
        </if>
        <if test="consignmentDeliveryDocumentNumber !=null and consignmentDeliveryDocumentNumber !='' ">
            and consignmentDeliveryDocumentNumber = #{consignmentDeliveryDocumentNumber}
        </if>
        <if test="inspector !=null and inspector !='' ">
            and inspector = #{inspector}
        </if>
    </select>


    <update id="updateSKcBbProductinspection" parameterType="pd" >
        update s_kc_bb_productinspection
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="inspectionDocumentNumber !=null and inspectionDocumentNumber !='' ">
            inspectionDocumentNumber = #{inspectionDocumentNumber},
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            dosageForm = #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="barcode !=null and barcode !='' ">
            barcode = #{barcode},
        </if>
        <if test="businessScope !=null and businessScope !='' ">
            businessScope = #{businessScope},
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
            approvalNumber = #{approvalNumber},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
            batch = #{batch},
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
            inspectionDate = #{inspectionDate},
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            productionDate = #{productionDate},
        </if>
        <if test="validityPeriod !=null and validityPeriod !='' ">
            validityPeriod = #{validityPeriod},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier = #{supplier},
        </if>
        <if test="arrivalQuantity !=null and arrivalQuantity !='' ">
            arrivalQuantity = #{arrivalQuantity},
        </if>
        <if test="inspectionQualifiedQuantity !=null and inspectionQualifiedQuantity !='' ">
            inspectionQualifiedQuantity = #{inspectionQualifiedQuantity},
        </if>
        <if test="costPrice !=null and costPrice !='' ">
            costPrice = #{costPrice},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount = #{costAmount},
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            sapDeliveryDocumentNumber = #{sapDeliveryDocumentNumber},
        </if>
        <if test="consignmentDeliveryDocumentNumber !=null and consignmentDeliveryDocumentNumber !='' ">
            consignmentDeliveryDocumentNumber = #{consignmentDeliveryDocumentNumber},
        </if>
        <if test="inspector !=null and inspector !='' ">
            inspector = #{inspector},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="inspectionDocumentNumber !=null and inspectionDocumentNumber !='' ">
            inspectionDocumentNumber,
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            dosageForm,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="barcode !=null and barcode !='' ">
            barcode,
        </if>
        <if test="businessScope !=null and businessScope !='' ">
            businessScope,
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
            approvalNumber,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="batch !=null and batch !='' ">
            batch,
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
            inspectionDate,
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            productionDate,
        </if>
        <if test="validityPeriod !=null and validityPeriod !='' ">
            validityPeriod,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier,
        </if>
        <if test="arrivalQuantity !=null and arrivalQuantity !='' ">
            arrivalQuantity,
        </if>
        <if test="inspectionQualifiedQuantity !=null and inspectionQualifiedQuantity !='' ">
            inspectionQualifiedQuantity,
        </if>
        <if test="costPrice !=null and costPrice !='' ">
            costPrice,
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount,
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            sapDeliveryDocumentNumber,
        </if>
        <if test="consignmentDeliveryDocumentNumber !=null and consignmentDeliveryDocumentNumber !='' ">
            consignmentDeliveryDocumentNumber,
        </if>
        <if test="inspector !=null and inspector !='' ">
            inspector,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
             #{storeShortName},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="inspectionDocumentNumber !=null and inspectionDocumentNumber !='' ">
             #{inspectionDocumentNumber},
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
             #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="barcode !=null and barcode !='' ">
             #{barcode},
        </if>
        <if test="businessScope !=null and businessScope !='' ">
             #{businessScope},
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
             #{approvalNumber},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
             #{batch},
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
             #{inspectionDate},
        </if>
        <if test="productionDate !=null and productionDate !='' ">
             #{productionDate},
        </if>
        <if test="validityPeriod !=null and validityPeriod !='' ">
             #{validityPeriod},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="supplier !=null and supplier !='' ">
             #{supplier},
        </if>
        <if test="arrivalQuantity !=null and arrivalQuantity !='' ">
             #{arrivalQuantity},
        </if>
        <if test="inspectionQualifiedQuantity !=null and inspectionQualifiedQuantity !='' ">
             #{inspectionQualifiedQuantity},
        </if>
        <if test="costPrice !=null and costPrice !='' ">
             #{costPrice},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
             #{costAmount},
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
             #{sapDeliveryDocumentNumber},
        </if>
        <if test="consignmentDeliveryDocumentNumber !=null and consignmentDeliveryDocumentNumber !='' ">
             #{consignmentDeliveryDocumentNumber},
        </if>
        <if test="inspector !=null and inspector !='' ">
             #{inspector},
        </if>
        </trim>

    </insert>

</mapper>
