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

    <select id="selectSXsglXsmxDdmxSalesorderinfoList" parameterType="pd" resultType="pd">
        select * from s_xsgl_xsmx_ddmx_salesorderinfo where 1=1
        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
            and saleDocumentNumber = #{saleDocumentNumber}
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
            and orderStatus = #{orderStatus}
        </if>
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="transferStatus !=null and transferStatus !='' ">
            and transferStatus = #{transferStatus}
        </if>
        <if test="saleDate !=null and saleDate !='' ">
            and saleDate = #{saleDate}
        </if>
        <if test="member !=null and member !='' ">
            and member = #{member}
        </if>
        <if test="cashier !=null and cashier !='' ">
            and cashier = #{cashier}
        </if>
        <if test="picker !=null and picker !='' ">
            and picker = #{picker}
        </if>
        <if test="pickerCode !=null and pickerCode !='' ">
            and pickerCode = #{pickerCode}
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            and orderSource = #{orderSource}
        </if>
        <if test="channelDocumentNumber !=null and channelDocumentNumber !='' ">
            and channelDocumentNumber = #{channelDocumentNumber}
        </if>
        <if test="om !=null and om !='' ">
            and om = #{om}
        </if>
    </select>


    <update id="updateSXsglXsmxDdmxSalesorderinfo" parameterType="pd" >
        update s_xsgl_xsmx_ddmx_salesorderinfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
            saleDocumentNumber = #{saleDocumentNumber},
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
            orderStatus = #{orderStatus},
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="transferStatus !=null and transferStatus !='' ">
            transferStatus = #{transferStatus},
        </if>
        <if test="saleDate !=null and saleDate !='' ">
            saleDate = #{saleDate},
        </if>
        <if test="member !=null and member !='' ">
            member = #{member},
        </if>
        <if test="cashier !=null and cashier !='' ">
            cashier = #{cashier},
        </if>
        <if test="picker !=null and picker !='' ">
            picker = #{picker},
        </if>
        <if test="pickerCode !=null and pickerCode !='' ">
            pickerCode = #{pickerCode},
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            orderSource = #{orderSource},
        </if>
        <if test="channelDocumentNumber !=null and channelDocumentNumber !='' ">
            channelDocumentNumber = #{channelDocumentNumber},
        </if>
        <if test="om !=null and om !='' ">
            om = #{om},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
            saleDocumentNumber,
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
            orderStatus,
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="transferStatus !=null and transferStatus !='' ">
            transferStatus,
        </if>
        <if test="saleDate !=null and saleDate !='' ">
            saleDate,
        </if>
        <if test="member !=null and member !='' ">
            member,
        </if>
        <if test="cashier !=null and cashier !='' ">
            cashier,
        </if>
        <if test="picker !=null and picker !='' ">
            picker,
        </if>
        <if test="pickerCode !=null and pickerCode !='' ">
            pickerCode,
        </if>
        <if test="orderSource !=null and orderSource !='' ">
            orderSource,
        </if>
        <if test="channelDocumentNumber !=null and channelDocumentNumber !='' ">
            channelDocumentNumber,
        </if>
        <if test="om !=null and om !='' ">
            om,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
             #{saleDocumentNumber},
        </if>
        <if test="orderStatus !=null and orderStatus !='' ">
             #{orderStatus},
        </if>
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="transferStatus !=null and transferStatus !='' ">
             #{transferStatus},
        </if>
        <if test="saleDate !=null and saleDate !='' ">
             #{saleDate},
        </if>
        <if test="member !=null and member !='' ">
             #{member},
        </if>
        <if test="cashier !=null and cashier !='' ">
             #{cashier},
        </if>
        <if test="picker !=null and picker !='' ">
             #{picker},
        </if>
        <if test="pickerCode !=null and pickerCode !='' ">
             #{pickerCode},
        </if>
        <if test="orderSource !=null and orderSource !='' ">
             #{orderSource},
        </if>
        <if test="channelDocumentNumber !=null and channelDocumentNumber !='' ">
             #{channelDocumentNumber},
        </if>
        <if test="om !=null and om !='' ">
             #{om},
        </if>
        </trim>

    </insert>

</mapper>
