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

    <select id="selectSCgxsTgypTgypdjList" parameterType="pd" resultType="pd">
        select * from s_cgxs_tgyp_tgypdj where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            and createdBy = #{createdBy}
        </if>
        <if test="createdDate !=null and createdDate !='' ">
            and createdDate = #{createdDate}
        </if>
        <if test="saleDate !=null and saleDate !='' ">
            and saleDate = #{saleDate}
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
            and saleOrderNumber = #{saleOrderNumber}
        </if>
        <if test="registerTime !=null and registerTime !='' ">
            and registerTime = #{registerTime}
        </if>
        <if test="customerName !=null and customerName !='' ">
            and customerName = #{customerName}
        </if>
        <if test="gender !=null and gender !='' ">
            and gender = #{gender}
        </if>
        <if test="idNumber !=null and idNumber !='' ">
            and idNumber = #{idNumber}
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
            and contactPhone = #{contactPhone}
        </if>
        <if test="salesperson !=null and salesperson !='' ">
            and salesperson = #{salesperson}
        </if>
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="medicineCode !=null and medicineCode !='' ">
            and medicineCode = #{medicineCode}
        </if>
    </select>


    <update id="updateSCgxsTgypTgypdj" parameterType="pd" >
        update s_cgxs_tgyp_tgypdj
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="createdBy !=null and createdBy !='' ">
            createdBy = #{createdBy},
        </if>
        <if test="createdDate !=null and createdDate !='' ">
            createdDate = #{createdDate},
        </if>
        <if test="saleDate !=null and saleDate !='' ">
            saleDate = #{saleDate},
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
            saleOrderNumber = #{saleOrderNumber},
        </if>
        <if test="registerTime !=null and registerTime !='' ">
            registerTime = #{registerTime},
        </if>
        <if test="customerName !=null and customerName !='' ">
            customerName = #{customerName},
        </if>
        <if test="gender !=null and gender !='' ">
            gender = #{gender},
        </if>
        <if test="idNumber !=null and idNumber !='' ">
            idNumber = #{idNumber},
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
            contactPhone = #{contactPhone},
        </if>
        <if test="salesperson !=null and salesperson !='' ">
            salesperson = #{salesperson},
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="medicineCode !=null and medicineCode !='' ">
            medicineCode = #{medicineCode},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="createdBy !=null and createdBy !='' ">
            createdBy,
        </if>
        <if test="createdDate !=null and createdDate !='' ">
            createdDate,
        </if>
        <if test="saleDate !=null and saleDate !='' ">
            saleDate,
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
            saleOrderNumber,
        </if>
        <if test="registerTime !=null and registerTime !='' ">
            registerTime,
        </if>
        <if test="customerName !=null and customerName !='' ">
            customerName,
        </if>
        <if test="gender !=null and gender !='' ">
            gender,
        </if>
        <if test="idNumber !=null and idNumber !='' ">
            idNumber,
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
            contactPhone,
        </if>
        <if test="salesperson !=null and salesperson !='' ">
            salesperson,
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="medicineCode !=null and medicineCode !='' ">
            medicineCode,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="createdBy !=null and createdBy !='' ">
             #{createdBy},
        </if>
        <if test="createdDate !=null and createdDate !='' ">
             #{createdDate},
        </if>
        <if test="saleDate !=null and saleDate !='' ">
             #{saleDate},
        </if>
        <if test="saleOrderNumber !=null and saleOrderNumber !='' ">
             #{saleOrderNumber},
        </if>
        <if test="registerTime !=null and registerTime !='' ">
             #{registerTime},
        </if>
        <if test="customerName !=null and customerName !='' ">
             #{customerName},
        </if>
        <if test="gender !=null and gender !='' ">
             #{gender},
        </if>
        <if test="idNumber !=null and idNumber !='' ">
             #{idNumber},
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
             #{contactPhone},
        </if>
        <if test="salesperson !=null and salesperson !='' ">
             #{salesperson},
        </if>
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="medicineCode !=null and medicineCode !='' ">
             #{medicineCode},
        </if>
        </trim>

    </insert>

</mapper>
