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

    <select id="selectSKcCrkDcshStorepurchasereceiptList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_dcsh_storepurchasereceipt where 1=1
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="purchaseReceiptNumber !=null and purchaseReceiptNumber !='' ">
            and purchaseReceiptNumber = #{purchaseReceiptNumber}
        </if>
        <if test="purchaseOrderNumber !=null and purchaseOrderNumber !='' ">
            and purchaseOrderNumber = #{purchaseOrderNumber}
        </if>
        <if test="supplier !=null and supplier !='' ">
            and supplier = #{supplier}
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
            and totalCostAmount = #{totalCostAmount}
        </if>
        <if test="receiver !=null and receiver !='' ">
            and receiver = #{receiver}
        </if>
        <if test="receiptStatus !=null and receiptStatus !='' ">
            and receiptStatus = #{receiptStatus}
        </if>
        <if test="receiptTime !=null and receiptTime !='' ">
            and receiptTime = #{receiptTime}
        </if>
    </select>


    <update id="updateSKcCrkDcshStorepurchasereceipt" parameterType="pd" >
        update s_kc_crk_dcsh_storepurchasereceipt
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="purchaseReceiptNumber !=null and purchaseReceiptNumber !='' ">
            purchaseReceiptNumber = #{purchaseReceiptNumber},
        </if>
        <if test="purchaseOrderNumber !=null and purchaseOrderNumber !='' ">
            purchaseOrderNumber = #{purchaseOrderNumber},
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier = #{supplier},
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
            totalCostAmount = #{totalCostAmount},
        </if>
        <if test="receiver !=null and receiver !='' ">
            receiver = #{receiver},
        </if>
        <if test="receiptStatus !=null and receiptStatus !='' ">
            receiptStatus = #{receiptStatus},
        </if>
        <if test="receiptTime !=null and receiptTime !='' ">
            receiptTime = #{receiptTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="purchaseReceiptNumber !=null and purchaseReceiptNumber !='' ">
            purchaseReceiptNumber,
        </if>
        <if test="purchaseOrderNumber !=null and purchaseOrderNumber !='' ">
            purchaseOrderNumber,
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier,
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
            totalCostAmount,
        </if>
        <if test="receiver !=null and receiver !='' ">
            receiver,
        </if>
        <if test="receiptStatus !=null and receiptStatus !='' ">
            receiptStatus,
        </if>
        <if test="receiptTime !=null and receiptTime !='' ">
            receiptTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
             #{storeShortName},
        </if>
        <if test="purchaseReceiptNumber !=null and purchaseReceiptNumber !='' ">
             #{purchaseReceiptNumber},
        </if>
        <if test="purchaseOrderNumber !=null and purchaseOrderNumber !='' ">
             #{purchaseOrderNumber},
        </if>
        <if test="supplier !=null and supplier !='' ">
             #{supplier},
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
             #{totalCostAmount},
        </if>
        <if test="receiver !=null and receiver !='' ">
             #{receiver},
        </if>
        <if test="receiptStatus !=null and receiptStatus !='' ">
             #{receiptStatus},
        </if>
        <if test="receiptTime !=null and receiptTime !='' ">
             #{receiptTime},
        </if>
        </trim>

    </insert>

</mapper>
