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

    <select id="selectSKcCrkDcshStorepurchaserequestList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_dcsh_storepurchaserequest where 1=1
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="purchaseRequestNumber !=null and purchaseRequestNumber !='' ">
            and purchaseRequestNumber = #{purchaseRequestNumber}
        </if>
        <if test="supplier !=null and supplier !='' ">
            and supplier = #{supplier}
        </if>
        <if test="creator !=null and creator !='' ">
            and creator = #{creator}
        </if>
        <if test="creationTime !=null and creationTime !='' ">
            and creationTime = #{creationTime}
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
            and totalCostAmount = #{totalCostAmount}
        </if>
        <if test="reviewStatus !=null and reviewStatus !='' ">
            and reviewStatus = #{reviewStatus}
        </if>
        <if test="reviewer !=null and reviewer !='' ">
            and reviewer = #{reviewer}
        </if>
        <if test="reviewTime !=null and reviewTime !='' ">
            and reviewTime = #{reviewTime}
        </if>
    </select>


    <update id="updateSKcCrkDcshStorepurchaserequest" parameterType="pd" >
        update s_kc_crk_dcsh_storepurchaserequest
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="purchaseRequestNumber !=null and purchaseRequestNumber !='' ">
            purchaseRequestNumber = #{purchaseRequestNumber},
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier = #{supplier},
        </if>
        <if test="creator !=null and creator !='' ">
            creator = #{creator},
        </if>
        <if test="creationTime !=null and creationTime !='' ">
            creationTime = #{creationTime},
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
            totalCostAmount = #{totalCostAmount},
        </if>
        <if test="reviewStatus !=null and reviewStatus !='' ">
            reviewStatus = #{reviewStatus},
        </if>
        <if test="reviewer !=null and reviewer !='' ">
            reviewer = #{reviewer},
        </if>
        <if test="reviewTime !=null and reviewTime !='' ">
            reviewTime = #{reviewTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="purchaseRequestNumber !=null and purchaseRequestNumber !='' ">
            purchaseRequestNumber,
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier,
        </if>
        <if test="creator !=null and creator !='' ">
            creator,
        </if>
        <if test="creationTime !=null and creationTime !='' ">
            creationTime,
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
            totalCostAmount,
        </if>
        <if test="reviewStatus !=null and reviewStatus !='' ">
            reviewStatus,
        </if>
        <if test="reviewer !=null and reviewer !='' ">
            reviewer,
        </if>
        <if test="reviewTime !=null and reviewTime !='' ">
            reviewTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
             #{storeShortName},
        </if>
        <if test="purchaseRequestNumber !=null and purchaseRequestNumber !='' ">
             #{purchaseRequestNumber},
        </if>
        <if test="supplier !=null and supplier !='' ">
             #{supplier},
        </if>
        <if test="creator !=null and creator !='' ">
             #{creator},
        </if>
        <if test="creationTime !=null and creationTime !='' ">
             #{creationTime},
        </if>
        <if test="totalCostAmount !=null and totalCostAmount !='' ">
             #{totalCostAmount},
        </if>
        <if test="reviewStatus !=null and reviewStatus !='' ">
             #{reviewStatus},
        </if>
        <if test="reviewer !=null and reviewer !='' ">
             #{reviewer},
        </if>
        <if test="reviewTime !=null and reviewTime !='' ">
             #{reviewTime},
        </if>
        </trim>

    </insert>

</mapper>
