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

    <select id="selectSXsglReturninfoList" parameterType="pd" resultType="pd">
        select * from s_xsgl_returninfo where 1=1
        <if test="returnDate !=null and returnDate !='' ">
            and returnDate = #{returnDate}
        </if>
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
            and returnDocumentNumber = #{returnDocumentNumber}
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            and orderSource = #{orderSource}
        </if>
        <if test="originalDocumentNumber !=null and originalDocumentNumber !='' ">
            and originalDocumentNumber = #{originalDocumentNumber}
        </if>
        <if test="returnType !=null and returnType !='' ">
            and returnType = #{returnType}
        </if>
        <if test="returnReason !=null and returnReason !='' ">
            and returnReason = #{returnReason}
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
            and returnQuantity = #{returnQuantity}
        </if>
        <if test="actualRefundAmount !=null and actualRefundAmount !='' ">
            and actualRefundAmount = #{actualRefundAmount}
        </if>
        <if test="memberName !=null and memberName !='' ">
            and memberName = #{memberName}
        </if>
        <if test="refundAgent !=null and refundAgent !='' ">
            and refundAgent = #{refundAgent}
        </if>
        <if test="reviewer !=null and reviewer !='' ">
            and reviewer = #{reviewer}
        </if>
        <if test="remarks !=null and remarks !='' ">
            and remarks = #{remarks}
        </if>
    </select>


    <update id="updateSXsglReturninfo" parameterType="pd" >
        update s_xsgl_returninfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="returnDate !=null and returnDate !='' ">
            returnDate = #{returnDate},
        </if>
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
            returnDocumentNumber = #{returnDocumentNumber},
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            orderSource = #{orderSource},
        </if>
        <if test="originalDocumentNumber !=null and originalDocumentNumber !='' ">
            originalDocumentNumber = #{originalDocumentNumber},
        </if>
        <if test="returnType !=null and returnType !='' ">
            returnType = #{returnType},
        </if>
        <if test="returnReason !=null and returnReason !='' ">
            returnReason = #{returnReason},
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
            returnQuantity = #{returnQuantity},
        </if>
        <if test="actualRefundAmount !=null and actualRefundAmount !='' ">
            actualRefundAmount = #{actualRefundAmount},
        </if>
        <if test="memberName !=null and memberName !='' ">
            memberName = #{memberName},
        </if>
        <if test="refundAgent !=null and refundAgent !='' ">
            refundAgent = #{refundAgent},
        </if>
        <if test="reviewer !=null and reviewer !='' ">
            reviewer = #{reviewer},
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks = #{remarks},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="returnDate !=null and returnDate !='' ">
            returnDate,
        </if>
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
            returnDocumentNumber,
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            orderSource,
        </if>
        <if test="originalDocumentNumber !=null and originalDocumentNumber !='' ">
            originalDocumentNumber,
        </if>
        <if test="returnType !=null and returnType !='' ">
            returnType,
        </if>
        <if test="returnReason !=null and returnReason !='' ">
            returnReason,
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
            returnQuantity,
        </if>
        <if test="actualRefundAmount !=null and actualRefundAmount !='' ">
            actualRefundAmount,
        </if>
        <if test="memberName !=null and memberName !='' ">
            memberName,
        </if>
        <if test="refundAgent !=null and refundAgent !='' ">
            refundAgent,
        </if>
        <if test="reviewer !=null and reviewer !='' ">
            reviewer,
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="returnDate !=null and returnDate !='' ">
             #{returnDate},
        </if>
        <if test="returnDocumentNumber !=null and returnDocumentNumber !='' ">
             #{returnDocumentNumber},
        </if>
        <if test="orderSource !=null and orderSource !='' ">
             #{orderSource},
        </if>
        <if test="originalDocumentNumber !=null and originalDocumentNumber !='' ">
             #{originalDocumentNumber},
        </if>
        <if test="returnType !=null and returnType !='' ">
             #{returnType},
        </if>
        <if test="returnReason !=null and returnReason !='' ">
             #{returnReason},
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
             #{returnQuantity},
        </if>
        <if test="actualRefundAmount !=null and actualRefundAmount !='' ">
             #{actualRefundAmount},
        </if>
        <if test="memberName !=null and memberName !='' ">
             #{memberName},
        </if>
        <if test="refundAgent !=null and refundAgent !='' ">
             #{refundAgent},
        </if>
        <if test="reviewer !=null and reviewer !='' ">
             #{reviewer},
        </if>
        <if test="remarks !=null and remarks !='' ">
             #{remarks},
        </if>
        </trim>

    </insert>

</mapper>
