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

    <select id="selectSSpglProductdetailsList" parameterType="pd" resultType="pd">
        select * from s_spgl_productdetails where 1=1
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="genericName !=null and genericName !='' ">
            and genericName = #{genericName}
        </if>
        <if test="productCategory !=null and productCategory !='' ">
            and productCategory = #{productCategory}
        </if>
        <if test="brandName !=null and brandName !='' ">
            and brandName = #{brandName}
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
            and retailPrice = #{retailPrice}
        </if>
        <if test="salesAttributes !=null and salesAttributes !='' ">
            and salesAttributes = #{salesAttributes}
        </if>
        <if test="minimumPrice !=null and minimumPrice !='' ">
            and minimumPrice = #{minimumPrice}
        </if>
        <if test="productionLicenseNumber !=null and productionLicenseNumber !='' ">
            and productionLicenseNumber = #{productionLicenseNumber}
        </if>
        <if test="productionLicenseValidUntil !=null and productionLicenseValidUntil !='' ">
            and productionLicenseValidUntil = #{productionLicenseValidUntil}
        </if>
        <if test="unitOfDispensing !=null and unitOfDispensing !='' ">
            and unitOfDispensing = #{unitOfDispensing}
        </if>
        <if test="isDispensable !=null and isDispensable !='' ">
            and isDispensable = #{isDispensable}
        </if>
        <if test="dispensingRatio !=null and dispensingRatio !='' ">
            and dispensingRatio = #{dispensingRatio}
        </if>
        <if test="uniqueCode !=null and uniqueCode !='' ">
            and uniqueCode = #{uniqueCode}
        </if>
        <if test="marketingAuthorizationHolder !=null and marketingAuthorizationHolder !='' ">
            and marketingAuthorizationHolder = #{marketingAuthorizationHolder}
        </if>
        <if test="prescriptionCategory !=null and prescriptionCategory !='' ">
            and prescriptionCategory = #{prescriptionCategory}
        </if>
        <if test="prescriptionCategorySecondLevel !=null and prescriptionCategorySecondLevel !='' ">
            and prescriptionCategorySecondLevel = #{prescriptionCategorySecondLevel}
        </if>
        <if test="prescriptionCategoryThirdLevel !=null and prescriptionCategoryThirdLevel !='' ">
            and prescriptionCategoryThirdLevel = #{prescriptionCategoryThirdLevel}
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
            and approvalNumber = #{approvalNumber}
        </if>
        <if test="approvalNumberValidUntil !=null and approvalNumberValidUntil !='' ">
            and approvalNumberValidUntil = #{approvalNumberValidUntil}
        </if>
        <if test="approvalNumberTwo !=null and approvalNumberTwo !='' ">
            and approvalNumberTwo = #{approvalNumberTwo}
        </if>
        <if test="approvalNumberTwoValidUntil !=null and approvalNumberTwoValidUntil !='' ">
            and approvalNumberTwoValidUntil = #{approvalNumberTwoValidUntil}
        </if>
        <if test="approvalNumberThree !=null and approvalNumberThree !='' ">
            and approvalNumberThree = #{approvalNumberThree}
        </if>
        <if test="approvalNumberThreeValidUntil !=null and approvalNumberThreeValidUntil !='' ">
            and approvalNumberThreeValidUntil = #{approvalNumberThreeValidUntil}
        </if>
        <if test="registrationNumber !=null and registrationNumber !='' ">
            and registrationNumber = #{registrationNumber}
        </if>
        <if test="registrationNumberValidUntil !=null and registrationNumberValidUntil !='' ">
            and registrationNumberValidUntil = #{registrationNumberValidUntil}
        </if>
        <if test="registrationNumberTwo !=null and registrationNumberTwo !='' ">
            and registrationNumberTwo = #{registrationNumberTwo}
        </if>
        <if test="registrationNumberTwoValidUntil !=null and registrationNumberTwoValidUntil !='' ">
            and registrationNumberTwoValidUntil = #{registrationNumberTwoValidUntil}
        </if>
    </select>


    <update id="updateSSpglProductdetails" parameterType="pd" >
        update s_spgl_productdetails
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="genericName !=null and genericName !='' ">
            genericName = #{genericName},
        </if>
        <if test="productCategory !=null and productCategory !='' ">
            productCategory = #{productCategory},
        </if>
        <if test="brandName !=null and brandName !='' ">
            brandName = #{brandName},
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
            retailPrice = #{retailPrice},
        </if>
        <if test="salesAttributes !=null and salesAttributes !='' ">
            salesAttributes = #{salesAttributes},
        </if>
        <if test="minimumPrice !=null and minimumPrice !='' ">
            minimumPrice = #{minimumPrice},
        </if>
        <if test="productionLicenseNumber !=null and productionLicenseNumber !='' ">
            productionLicenseNumber = #{productionLicenseNumber},
        </if>
        <if test="productionLicenseValidUntil !=null and productionLicenseValidUntil !='' ">
            productionLicenseValidUntil = #{productionLicenseValidUntil},
        </if>
        <if test="unitOfDispensing !=null and unitOfDispensing !='' ">
            unitOfDispensing = #{unitOfDispensing},
        </if>
        <if test="isDispensable !=null and isDispensable !='' ">
            isDispensable = #{isDispensable},
        </if>
        <if test="dispensingRatio !=null and dispensingRatio !='' ">
            dispensingRatio = #{dispensingRatio},
        </if>
        <if test="uniqueCode !=null and uniqueCode !='' ">
            uniqueCode = #{uniqueCode},
        </if>
        <if test="marketingAuthorizationHolder !=null and marketingAuthorizationHolder !='' ">
            marketingAuthorizationHolder = #{marketingAuthorizationHolder},
        </if>
        <if test="prescriptionCategory !=null and prescriptionCategory !='' ">
            prescriptionCategory = #{prescriptionCategory},
        </if>
        <if test="prescriptionCategorySecondLevel !=null and prescriptionCategorySecondLevel !='' ">
            prescriptionCategorySecondLevel = #{prescriptionCategorySecondLevel},
        </if>
        <if test="prescriptionCategoryThirdLevel !=null and prescriptionCategoryThirdLevel !='' ">
            prescriptionCategoryThirdLevel = #{prescriptionCategoryThirdLevel},
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
            approvalNumber = #{approvalNumber},
        </if>
        <if test="approvalNumberValidUntil !=null and approvalNumberValidUntil !='' ">
            approvalNumberValidUntil = #{approvalNumberValidUntil},
        </if>
        <if test="approvalNumberTwo !=null and approvalNumberTwo !='' ">
            approvalNumberTwo = #{approvalNumberTwo},
        </if>
        <if test="approvalNumberTwoValidUntil !=null and approvalNumberTwoValidUntil !='' ">
            approvalNumberTwoValidUntil = #{approvalNumberTwoValidUntil},
        </if>
        <if test="approvalNumberThree !=null and approvalNumberThree !='' ">
            approvalNumberThree = #{approvalNumberThree},
        </if>
        <if test="approvalNumberThreeValidUntil !=null and approvalNumberThreeValidUntil !='' ">
            approvalNumberThreeValidUntil = #{approvalNumberThreeValidUntil},
        </if>
        <if test="registrationNumber !=null and registrationNumber !='' ">
            registrationNumber = #{registrationNumber},
        </if>
        <if test="registrationNumberValidUntil !=null and registrationNumberValidUntil !='' ">
            registrationNumberValidUntil = #{registrationNumberValidUntil},
        </if>
        <if test="registrationNumberTwo !=null and registrationNumberTwo !='' ">
            registrationNumberTwo = #{registrationNumberTwo},
        </if>
        <if test="registrationNumberTwoValidUntil !=null and registrationNumberTwoValidUntil !='' ">
            registrationNumberTwoValidUntil = #{registrationNumberTwoValidUntil},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="genericName !=null and genericName !='' ">
            genericName,
        </if>
        <if test="productCategory !=null and productCategory !='' ">
            productCategory,
        </if>
        <if test="brandName !=null and brandName !='' ">
            brandName,
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
            retailPrice,
        </if>
        <if test="salesAttributes !=null and salesAttributes !='' ">
            salesAttributes,
        </if>
        <if test="minimumPrice !=null and minimumPrice !='' ">
            minimumPrice,
        </if>
        <if test="productionLicenseNumber !=null and productionLicenseNumber !='' ">
            productionLicenseNumber,
        </if>
        <if test="productionLicenseValidUntil !=null and productionLicenseValidUntil !='' ">
            productionLicenseValidUntil,
        </if>
        <if test="unitOfDispensing !=null and unitOfDispensing !='' ">
            unitOfDispensing,
        </if>
        <if test="isDispensable !=null and isDispensable !='' ">
            isDispensable,
        </if>
        <if test="dispensingRatio !=null and dispensingRatio !='' ">
            dispensingRatio,
        </if>
        <if test="uniqueCode !=null and uniqueCode !='' ">
            uniqueCode,
        </if>
        <if test="marketingAuthorizationHolder !=null and marketingAuthorizationHolder !='' ">
            marketingAuthorizationHolder,
        </if>
        <if test="prescriptionCategory !=null and prescriptionCategory !='' ">
            prescriptionCategory,
        </if>
        <if test="prescriptionCategorySecondLevel !=null and prescriptionCategorySecondLevel !='' ">
            prescriptionCategorySecondLevel,
        </if>
        <if test="prescriptionCategoryThirdLevel !=null and prescriptionCategoryThirdLevel !='' ">
            prescriptionCategoryThirdLevel,
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
            approvalNumber,
        </if>
        <if test="approvalNumberValidUntil !=null and approvalNumberValidUntil !='' ">
            approvalNumberValidUntil,
        </if>
        <if test="approvalNumberTwo !=null and approvalNumberTwo !='' ">
            approvalNumberTwo,
        </if>
        <if test="approvalNumberTwoValidUntil !=null and approvalNumberTwoValidUntil !='' ">
            approvalNumberTwoValidUntil,
        </if>
        <if test="approvalNumberThree !=null and approvalNumberThree !='' ">
            approvalNumberThree,
        </if>
        <if test="approvalNumberThreeValidUntil !=null and approvalNumberThreeValidUntil !='' ">
            approvalNumberThreeValidUntil,
        </if>
        <if test="registrationNumber !=null and registrationNumber !='' ">
            registrationNumber,
        </if>
        <if test="registrationNumberValidUntil !=null and registrationNumberValidUntil !='' ">
            registrationNumberValidUntil,
        </if>
        <if test="registrationNumberTwo !=null and registrationNumberTwo !='' ">
            registrationNumberTwo,
        </if>
        <if test="registrationNumberTwoValidUntil !=null and registrationNumberTwoValidUntil !='' ">
            registrationNumberTwoValidUntil,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="genericName !=null and genericName !='' ">
             #{genericName},
        </if>
        <if test="productCategory !=null and productCategory !='' ">
             #{productCategory},
        </if>
        <if test="brandName !=null and brandName !='' ">
             #{brandName},
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
             #{retailPrice},
        </if>
        <if test="salesAttributes !=null and salesAttributes !='' ">
             #{salesAttributes},
        </if>
        <if test="minimumPrice !=null and minimumPrice !='' ">
             #{minimumPrice},
        </if>
        <if test="productionLicenseNumber !=null and productionLicenseNumber !='' ">
             #{productionLicenseNumber},
        </if>
        <if test="productionLicenseValidUntil !=null and productionLicenseValidUntil !='' ">
             #{productionLicenseValidUntil},
        </if>
        <if test="unitOfDispensing !=null and unitOfDispensing !='' ">
             #{unitOfDispensing},
        </if>
        <if test="isDispensable !=null and isDispensable !='' ">
             #{isDispensable},
        </if>
        <if test="dispensingRatio !=null and dispensingRatio !='' ">
             #{dispensingRatio},
        </if>
        <if test="uniqueCode !=null and uniqueCode !='' ">
             #{uniqueCode},
        </if>
        <if test="marketingAuthorizationHolder !=null and marketingAuthorizationHolder !='' ">
             #{marketingAuthorizationHolder},
        </if>
        <if test="prescriptionCategory !=null and prescriptionCategory !='' ">
             #{prescriptionCategory},
        </if>
        <if test="prescriptionCategorySecondLevel !=null and prescriptionCategorySecondLevel !='' ">
             #{prescriptionCategorySecondLevel},
        </if>
        <if test="prescriptionCategoryThirdLevel !=null and prescriptionCategoryThirdLevel !='' ">
             #{prescriptionCategoryThirdLevel},
        </if>
        <if test="approvalNumber !=null and approvalNumber !='' ">
             #{approvalNumber},
        </if>
        <if test="approvalNumberValidUntil !=null and approvalNumberValidUntil !='' ">
             #{approvalNumberValidUntil},
        </if>
        <if test="approvalNumberTwo !=null and approvalNumberTwo !='' ">
             #{approvalNumberTwo},
        </if>
        <if test="approvalNumberTwoValidUntil !=null and approvalNumberTwoValidUntil !='' ">
             #{approvalNumberTwoValidUntil},
        </if>
        <if test="approvalNumberThree !=null and approvalNumberThree !='' ">
             #{approvalNumberThree},
        </if>
        <if test="approvalNumberThreeValidUntil !=null and approvalNumberThreeValidUntil !='' ">
             #{approvalNumberThreeValidUntil},
        </if>
        <if test="registrationNumber !=null and registrationNumber !='' ">
             #{registrationNumber},
        </if>
        <if test="registrationNumberValidUntil !=null and registrationNumberValidUntil !='' ">
             #{registrationNumberValidUntil},
        </if>
        <if test="registrationNumberTwo !=null and registrationNumberTwo !='' ">
             #{registrationNumberTwo},
        </if>
        <if test="registrationNumberTwoValidUntil !=null and registrationNumberTwoValidUntil !='' ">
             #{registrationNumberTwoValidUntil},
        </if>
        </trim>

    </insert>

</mapper>
