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

    <select id="selectSDtpZskcxDrugInstructionsList" parameterType="pd" resultType="pd">
        select * from s_dtp_zskcx_drug_instructions where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="mdmCode !=null and mdmCode !='' ">
            and mdmCode = #{mdmCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="genericName !=null and genericName !='' ">
            and genericName = #{genericName}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="origin !=null and origin !='' ">
            and origin = #{origin}
        </if>
        <if test="isDeprecated !=null and isDeprecated !='' ">
            and isDeprecated = #{isDeprecated}
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            and createdAt = #{createdAt}
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            and updatedAt = #{updatedAt}
        </if>
    </select>


    <update id="updateSDtpZskcxDrugInstructions" parameterType="pd" >
        update s_dtp_zskcx_drug_instructions
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="mdmCode !=null and mdmCode !='' ">
            mdmCode = #{mdmCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="genericName !=null and genericName !='' ">
            genericName = #{genericName},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="origin !=null and origin !='' ">
            origin = #{origin},
        </if>
        <if test="isDeprecated !=null and isDeprecated !='' ">
            isDeprecated = #{isDeprecated},
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            createdAt = #{createdAt},
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            updatedAt = #{updatedAt},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="mdmCode !=null and mdmCode !='' ">
            mdmCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="genericName !=null and genericName !='' ">
            genericName,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="origin !=null and origin !='' ">
            origin,
        </if>
        <if test="isDeprecated !=null and isDeprecated !='' ">
            isDeprecated,
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            createdAt,
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            updatedAt,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="mdmCode !=null and mdmCode !='' ">
             #{mdmCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="genericName !=null and genericName !='' ">
             #{genericName},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="origin !=null and origin !='' ">
             #{origin},
        </if>
        <if test="isDeprecated !=null and isDeprecated !='' ">
             #{isDeprecated},
        </if>
        <if test="createdAt !=null and createdAt !='' ">
             #{createdAt},
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
             #{updatedAt},
        </if>
        </trim>

    </insert>

</mapper>
