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

    <select id="selectSZlglCfdjSaleprescriptioninfoList" parameterType="pd" resultType="pd">
        select * from s_zlgl_cfdj_saleprescriptioninfo where 1=1
        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
            and saleDocumentNumber = #{saleDocumentNumber}
        </if>
        <if test="saleTime !=null and saleTime !='' ">
            and saleTime = #{saleTime}
        </if>
        <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
            and saleTime between #{beginTime} and #{endTime}
        </if>
        <if test="registrationTime !=null and registrationTime !='' ">
            and registrationTime = #{registrationTime}
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
            and prescriptionNumber = #{prescriptionNumber}
        </if>
        <if test="types !=null and types !='' ">
            and types = #{types}
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
            and prescriptionDate = #{prescriptionDate}
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
            and medicalInstitutionName = #{medicalInstitutionName}
        </if>
        <if test="doctorName !=null and doctorName !='' ">
            and doctorName = #{doctorName}
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
            and customerInfo = #{customerInfo}
        </if>
        <if test="reviewingPharmacist !=null and reviewingPharmacist !='' ">
            and reviewingPharmacist = #{reviewingPharmacist}
        </if>
        <if test="dispenser !=null and dispenser !='' ">
            and dispenser = #{dispenser}
        </if>
        <if test="checker !=null and checker !='' ">
            and checker = #{checker}
        </if>
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
    </select>


    <update id="updateSZlglCfdjSaleprescriptioninfo" parameterType="pd" >
        update s_zlgl_cfdj_saleprescriptioninfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
            saleDocumentNumber = #{saleDocumentNumber},
        </if>
        <if test="saleTime !=null and saleTime !='' ">
            saleTime = #{saleTime},
        </if>
        <if test="registrationTime !=null and registrationTime !='' ">
            registrationTime = #{registrationTime},
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
            prescriptionNumber = #{prescriptionNumber},
        </if>
        <if test="types !=null and types !='' ">
            types = #{types},
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
            prescriptionDate = #{prescriptionDate},
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
            medicalInstitutionName = #{medicalInstitutionName},
        </if>
        <if test="doctorName !=null and doctorName !='' ">
            doctorName = #{doctorName},
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
            customerInfo = #{customerInfo},
        </if>
        <if test="reviewingPharmacist !=null and reviewingPharmacist !='' ">
            reviewingPharmacist = #{reviewingPharmacist},
        </if>
        <if test="dispenser !=null and dispenser !='' ">
            dispenser = #{dispenser},
        </if>
        <if test="checker !=null and checker !='' ">
            checker = #{checker},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
            saleDocumentNumber,
        </if>
        <if test="saleTime !=null and saleTime !='' ">
            saleTime,
        </if>
        <if test="registrationTime !=null and registrationTime !='' ">
            registrationTime,
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
            prescriptionNumber,
        </if>
        <if test="types !=null and types !='' ">
            types,
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
            prescriptionDate,
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
            medicalInstitutionName,
        </if>
        <if test="doctorName !=null and doctorName !='' ">
            doctorName,
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
            customerInfo,
        </if>
        <if test="reviewingPharmacist !=null and reviewingPharmacist !='' ">
            reviewingPharmacist,
        </if>
        <if test="dispenser !=null and dispenser !='' ">
            dispenser,
        </if>
        <if test="checker !=null and checker !='' ">
            checker,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="saleDocumentNumber !=null and saleDocumentNumber !='' ">
             #{saleDocumentNumber},
        </if>
        <if test="saleTime !=null and saleTime !='' ">
             #{saleTime},
        </if>
        <if test="registrationTime !=null and registrationTime !='' ">
             #{registrationTime},
        </if>
        <if test="prescriptionNumber !=null and prescriptionNumber !='' ">
             #{prescriptionNumber},
        </if>
        <if test="types !=null and types !='' ">
             #{types},
        </if>
        <if test="prescriptionDate !=null and prescriptionDate !='' ">
             #{prescriptionDate},
        </if>
        <if test="medicalInstitutionName !=null and medicalInstitutionName !='' ">
             #{medicalInstitutionName},
        </if>
        <if test="doctorName !=null and doctorName !='' ">
             #{doctorName},
        </if>
        <if test="customerInfo !=null and customerInfo !='' ">
             #{customerInfo},
        </if>
        <if test="reviewingPharmacist !=null and reviewingPharmacist !='' ">
             #{reviewingPharmacist},
        </if>
        <if test="dispenser !=null and dispenser !='' ">
             #{dispenser},
        </if>
        <if test="checker !=null and checker !='' ">
             #{checker},
        </if>
        </trim>

    </insert>

</mapper>
