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

    <select id="selectSKcCrkArrivalinfoList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_arrivalinfo where 1=1
        <if test="sequenceNumber !=null and sequenceNumber !='' ">
            and sequenceNumber = #{sequenceNumber}
        </if>
        <if test="arrivalStore !=null and arrivalStore !='' ">
            and arrivalStore = #{arrivalStore}
        </if>
        <if test="arrivalDocumentNumber !=null and arrivalDocumentNumber !='' ">
            and arrivalDocumentNumber = #{arrivalDocumentNumber}
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
            and sourceDocumentNumber = #{sourceDocumentNumber}
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            and sapDeliveryDocumentNumber = #{sapDeliveryDocumentNumber}
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
            and arrivalTime = #{arrivalTime}
        </if>
        <if test="submissionTime !=null and submissionTime !='' ">
            and submissionTime = #{submissionTime}
        </if>
        <if test="arrivalItemCount !=null and arrivalItemCount !='' ">
            and arrivalItemCount = #{arrivalItemCount}
        </if>
        <if test="discrepancyItemCount !=null and discrepancyItemCount !='' ">
            and discrepancyItemCount = #{discrepancyItemCount}
        </if>
    </select>


    <update id="updateSKcCrkArrivalinfo" parameterType="pd" >
        update s_kc_crk_arrivalinfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="sequenceNumber !=null and sequenceNumber !='' ">
            sequenceNumber = #{sequenceNumber},
        </if>
        <if test="arrivalStore !=null and arrivalStore !='' ">
            arrivalStore = #{arrivalStore},
        </if>
        <if test="arrivalDocumentNumber !=null and arrivalDocumentNumber !='' ">
            arrivalDocumentNumber = #{arrivalDocumentNumber},
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
            sourceDocumentNumber = #{sourceDocumentNumber},
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            sapDeliveryDocumentNumber = #{sapDeliveryDocumentNumber},
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
            arrivalTime = #{arrivalTime},
        </if>
        <if test="submissionTime !=null and submissionTime !='' ">
            submissionTime = #{submissionTime},
        </if>
        <if test="arrivalItemCount !=null and arrivalItemCount !='' ">
            arrivalItemCount = #{arrivalItemCount},
        </if>
        <if test="discrepancyItemCount !=null and discrepancyItemCount !='' ">
            discrepancyItemCount = #{discrepancyItemCount},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="sequenceNumber !=null and sequenceNumber !='' ">
            sequenceNumber,
        </if>
        <if test="arrivalStore !=null and arrivalStore !='' ">
            arrivalStore,
        </if>
        <if test="arrivalDocumentNumber !=null and arrivalDocumentNumber !='' ">
            arrivalDocumentNumber,
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
            sourceDocumentNumber,
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
            sapDeliveryDocumentNumber,
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
            arrivalTime,
        </if>
        <if test="submissionTime !=null and submissionTime !='' ">
            submissionTime,
        </if>
        <if test="arrivalItemCount !=null and arrivalItemCount !='' ">
            arrivalItemCount,
        </if>
        <if test="discrepancyItemCount !=null and discrepancyItemCount !='' ">
            discrepancyItemCount,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="sequenceNumber !=null and sequenceNumber !='' ">
             #{sequenceNumber},
        </if>
        <if test="arrivalStore !=null and arrivalStore !='' ">
             #{arrivalStore},
        </if>
        <if test="arrivalDocumentNumber !=null and arrivalDocumentNumber !='' ">
             #{arrivalDocumentNumber},
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
             #{sourceDocumentNumber},
        </if>
        <if test="sapDeliveryDocumentNumber !=null and sapDeliveryDocumentNumber !='' ">
             #{sapDeliveryDocumentNumber},
        </if>
        <if test="arrivalTime !=null and arrivalTime !='' ">
             #{arrivalTime},
        </if>
        <if test="submissionTime !=null and submissionTime !='' ">
             #{submissionTime},
        </if>
        <if test="arrivalItemCount !=null and arrivalItemCount !='' ">
             #{arrivalItemCount},
        </if>
        <if test="discrepancyItemCount !=null and discrepancyItemCount !='' ">
             #{discrepancyItemCount},
        </if>
        </trim>

    </insert>

</mapper>
