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

    <select id="selectSKcCrkYsrkCheckinList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_ysrk_checkin where 1=1
        <if test="acceptanceDocumentNumber !=null and acceptanceDocumentNumber !='' ">
            and acceptanceDocumentNumber = #{acceptanceDocumentNumber}
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
            and receiptDocumentNumber = #{receiptDocumentNumber}
        </if>
        <if test="acceptor !=null and acceptor !='' ">
            and acceptor = #{acceptor}
        </if>
        <if test="acceptanceTime !=null and acceptanceTime !='' ">
            and acceptanceTime = #{acceptanceTime}
        </if>
        <if test="parentDc !=null and parentDc !='' ">
            and parentDc = #{parentDc}
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            and sapDeliveryDocumentNumber = #{sapDeliveryDocumentNumber}
        </if>
        <if test="entrustedShipmentNumber !=null and entrustedShipmentNumber !='' ">
            and entrustedShipmentNumber = #{entrustedShipmentNumber}
        </if>
    </select>


    <update id="updateSKcCrkYsrkCheckin" parameterType="pd" >
        update s_kc_crk_ysrk_checkin
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="acceptanceDocumentNumber !=null and acceptanceDocumentNumber !='' ">
            acceptanceDocumentNumber = #{acceptanceDocumentNumber},
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
            receiptDocumentNumber = #{receiptDocumentNumber},
        </if>
        <if test="acceptor !=null and acceptor !='' ">
            acceptor = #{acceptor},
        </if>
        <if test="acceptanceTime !=null and acceptanceTime !='' ">
            acceptanceTime = #{acceptanceTime},
        </if>
        <if test="parentDc !=null and parentDc !='' ">
            parentDc = #{parentDc},
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            sapDeliveryDocumentNumber = #{sapDeliveryDocumentNumber},
        </if>
        <if test="entrustedShipmentNumber !=null and entrustedShipmentNumber !='' ">
            entrustedShipmentNumber = #{entrustedShipmentNumber},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="acceptanceDocumentNumber !=null and acceptanceDocumentNumber !='' ">
            acceptanceDocumentNumber,
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
            receiptDocumentNumber,
        </if>
        <if test="acceptor !=null and acceptor !='' ">
            acceptor,
        </if>
        <if test="acceptanceTime !=null and acceptanceTime !='' ">
            acceptanceTime,
        </if>
        <if test="parentDc !=null and parentDc !='' ">
            parentDc,
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            sapDeliveryDocumentNumber,
        </if>
        <if test="entrustedShipmentNumber !=null and entrustedShipmentNumber !='' ">
            entrustedShipmentNumber,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="acceptanceDocumentNumber !=null and acceptanceDocumentNumber !='' ">
             #{acceptanceDocumentNumber},
        </if>
        <if test="receiptDocumentNumber !=null and receiptDocumentNumber !='' ">
             #{receiptDocumentNumber},
        </if>
        <if test="acceptor !=null and acceptor !='' ">
             #{acceptor},
        </if>
        <if test="acceptanceTime !=null and acceptanceTime !='' ">
             #{acceptanceTime},
        </if>
        <if test="parentDc !=null and parentDc !='' ">
             #{parentDc},
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
             #{sapDeliveryDocumentNumber},
        </if>
        <if test="entrustedShipmentNumber !=null and entrustedShipmentNumber !='' ">
             #{entrustedShipmentNumber},
        </if>
        </trim>

    </insert>

</mapper>
