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

    <select id="selectSKcCrkThReturnList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_th_return where 1=1
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
            and returnDocumentNumber = #{returnDocumentNumber}
        </if>
        <if test="returnApplicationNumber !=null and returnApplicationNumber !='' ">
            and returnApplicationNumber = #{returnApplicationNumber}
        </if>
        <if test="returner !=null and returner !='' ">
            and returner = #{returner}
        </if>
        <if test="warehouseArea !=null and warehouseArea !='' ">
            and warehouseArea = #{warehouseArea}
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
            and documentStatus = #{documentStatus}
        </if>
    </select>


    <update id="updateSKcCrkThReturn" parameterType="pd" >
        update s_kc_crk_th_return
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
            returnDocumentNumber = #{returnDocumentNumber},
        </if>
        <if test="returnApplicationNumber !=null and returnApplicationNumber !='' ">
            returnApplicationNumber = #{returnApplicationNumber},
        </if>
        <if test="returner !=null and returner !='' ">
            returner = #{returner},
        </if>
        <if test="warehouseArea !=null and warehouseArea !='' ">
            warehouseArea = #{warehouseArea},
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
            documentStatus = #{documentStatus},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
            returnDocumentNumber,
        </if>
        <if test="returnApplicationNumber !=null and returnApplicationNumber !='' ">
            returnApplicationNumber,
        </if>
        <if test="returner !=null and returner !='' ">
            returner,
        </if>
        <if test="warehouseArea !=null and warehouseArea !='' ">
            warehouseArea,
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
            documentStatus,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
             #{returnDocumentNumber},
        </if>
        <if test="returnApplicationNumber !=null and returnApplicationNumber !='' ">
             #{returnApplicationNumber},
        </if>
        <if test="returner !=null and returner !='' ">
             #{returner},
        </if>
        <if test="warehouseArea !=null and warehouseArea !='' ">
             #{warehouseArea},
        </if>
        <if test="documentStatus !=null and documentStatus !='' ">
             #{documentStatus},
        </if>
        </trim>

    </insert>

</mapper>
