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

    <select id="selectSKcCrkDcthStorereturnorderList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_dcth_storereturnorder where 1=1
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="purchaseReturnNumber !=null and purchaseReturnNumber !='' ">
            and purchaseReturnNumber = #{purchaseReturnNumber}
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
            and documentStatus = #{documentStatus}
        </if>
        <if test="applicant !=null and applicant !='' ">
            and applicant = #{applicant}
        </if>
        <if test="applicationTime !=null and applicationTime !='' ">
            and applicationTime = #{applicationTime}
        </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="updateSKcCrkDcthStorereturnorder" parameterType="pd" >
        update s_kc_crk_dcth_storereturnorder
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="purchaseReturnNumber !=null and purchaseReturnNumber !='' ">
            purchaseReturnNumber = #{purchaseReturnNumber},
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
            documentStatus = #{documentStatus},
        </if>
        <if test="applicant !=null and applicant !='' ">
            applicant = #{applicant},
        </if>
        <if test="applicationTime !=null and applicationTime !='' ">
            applicationTime = #{applicationTime},
        </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="SKcCrkDcthStorereturnorderRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_kc_crk_dcth_storereturnorder where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

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

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

        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="purchaseReturnNumber !=null and purchaseReturnNumber !='' ">
            purchaseReturnNumber,
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
            documentStatus,
        </if>
        <if test="applicant !=null and applicant !='' ">
            applicant,
        </if>
        <if test="applicationTime !=null and applicationTime !='' ">
            applicationTime,
        </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="purchaseReturnNumber !=null and purchaseReturnNumber !='' ">
             #{purchaseReturnNumber},
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
             #{documentStatus},
        </if>
        <if test="applicant !=null and applicant !='' ">
             #{applicant},
        </if>
        <if test="applicationTime !=null and applicationTime !='' ">
             #{applicationTime},
        </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>
