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

    <select id="selectSKcBbReceiptorderitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_receiptorderitems where 1=1
        <if test="supplier !=null and supplier !='' ">
            and supplier = #{supplier}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
            and receiptDocumentNumber = #{receiptDocumentNumber}
        </if>
        <if test="receiptDate !=null and receiptDate !='' ">
            and receiptDate = #{receiptDate}
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            and dosageForm = #{dosageForm}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="origin !=null and origin !='' ">
            and origin = #{origin}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="shipmentQuantity !=null and shipmentQuantity !='' ">
            and shipmentQuantity = #{shipmentQuantity}
        </if>
        <if test="departureTime !=null and departureTime !='' ">
            and departureTime = #{departureTime}
        </if>
        <if test="departureTemperature !=null and departureTemperature !='' ">
            and departureTemperature = #{departureTemperature}
        </if>
        <if test="transportationMode !=null and transportationMode !='' ">
            and transportationMode = #{transportationMode}
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
            and arrivalTime = #{arrivalTime}
        </if>
        <if test="arrivalTemperature !=null and arrivalTemperature !='' ">
            and arrivalTemperature = #{arrivalTemperature}
        </if>
        <if test="receiptQuantity !=null and receiptQuantity !='' ">
            and receiptQuantity = #{receiptQuantity}
        </if>
        <if test="receiver !=null and receiver !='' ">
            and receiver = #{receiver}
        </if>
    </select>


    <update id="updateSKcBbReceiptorderitems" parameterType="pd" >
        update s_kc_bb_receiptorderitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="supplier !=null and supplier !='' ">
            supplier = #{supplier},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
            receiptDocumentNumber = #{receiptDocumentNumber},
        </if>
        <if test="receiptDate !=null and receiptDate !='' ">
            receiptDate = #{receiptDate},
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            dosageForm = #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="origin !=null and origin !='' ">
            origin = #{origin},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="shipmentQuantity !=null and shipmentQuantity !='' ">
            shipmentQuantity = #{shipmentQuantity},
        </if>
        <if test="departureTime !=null and departureTime !='' ">
            departureTime = #{departureTime},
        </if>
        <if test="departureTemperature !=null and departureTemperature !='' ">
            departureTemperature = #{departureTemperature},
        </if>
        <if test="transportationMode !=null and transportationMode !='' ">
            transportationMode = #{transportationMode},
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
            arrivalTime = #{arrivalTime},
        </if>
        <if test="arrivalTemperature !=null and arrivalTemperature !='' ">
            arrivalTemperature = #{arrivalTemperature},
        </if>
        <if test="receiptQuantity !=null and receiptQuantity !='' ">
            receiptQuantity = #{receiptQuantity},
        </if>
        <if test="receiver !=null and receiver !='' ">
            receiver = #{receiver},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="supplier !=null and supplier !='' ">
            supplier,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
            receiptDocumentNumber,
        </if>
        <if test="receiptDate !=null and receiptDate !='' ">
            receiptDate,
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            dosageForm,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="origin !=null and origin !='' ">
            origin,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="shipmentQuantity !=null and shipmentQuantity !='' ">
            shipmentQuantity,
        </if>
        <if test="departureTime !=null and departureTime !='' ">
            departureTime,
        </if>
        <if test="departureTemperature !=null and departureTemperature !='' ">
            departureTemperature,
        </if>
        <if test="transportationMode !=null and transportationMode !='' ">
            transportationMode,
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
            arrivalTime,
        </if>
        <if test="arrivalTemperature !=null and arrivalTemperature !='' ">
            arrivalTemperature,
        </if>
        <if test="receiptQuantity !=null and receiptQuantity !='' ">
            receiptQuantity,
        </if>
        <if test="receiver !=null and receiver !='' ">
            receiver,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="supplier !=null and supplier !='' ">
             #{supplier},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
             #{receiptDocumentNumber},
        </if>
        <if test="receiptDate !=null and receiptDate !='' ">
             #{receiptDate},
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
             #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="origin !=null and origin !='' ">
             #{origin},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="shipmentQuantity !=null and shipmentQuantity !='' ">
             #{shipmentQuantity},
        </if>
        <if test="departureTime !=null and departureTime !='' ">
             #{departureTime},
        </if>
        <if test="departureTemperature !=null and departureTemperature !='' ">
             #{departureTemperature},
        </if>
        <if test="transportationMode !=null and transportationMode !='' ">
             #{transportationMode},
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
             #{arrivalTime},
        </if>
        <if test="arrivalTemperature !=null and arrivalTemperature !='' ">
             #{arrivalTemperature},
        </if>
        <if test="receiptQuantity !=null and receiptQuantity !='' ">
             #{receiptQuantity},
        </if>
        <if test="receiver !=null and receiver !='' ">
             #{receiver},
        </if>
        </trim>

    </insert>

</mapper>
