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

    <select id="selectSDtpYypzFollowUpTemplateList" parameterType="pd" resultType="pd">
        select * from s_dtp_yypz_follow_up_template where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="drug !=null and drug !='' ">
            and drug = #{drug}
        </if>
        <if test="eventTag !=null and eventTag !='' ">
            and eventTag = #{eventTag}
        </if>
        <if test="templateId !=null and templateId !='' ">
            and templateId = #{templateId}
        </if>
        <if test="templateName !=null and templateName !='' ">
            and templateName = #{templateName}
        </if>
        <if test="taskCount !=null and taskCount !='' ">
            and taskCount = #{taskCount}
        </if>
        <if test="businessDomain !=null and businessDomain !='' ">
            and businessDomain = #{businessDomain}
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            and createdBy = #{createdBy}
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
            and updatedBy = #{updatedBy}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
        <if test="createdTime !=null and createdTime !='' ">
            and createdTime = #{createdTime}
        </if>
        <if test="updatedTime !=null and updatedTime !='' ">
            and updatedTime = #{updatedTime}
        </if>
    </select>


    <update id="updateSDtpYypzFollowUpTemplate" parameterType="pd" >
        update s_dtp_yypz_follow_up_template
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="drug !=null and drug !='' ">
            drug = #{drug},
        </if>
        <if test="eventTag !=null and eventTag !='' ">
            eventTag = #{eventTag},
        </if>
        <if test="templateId !=null and templateId !='' ">
            templateId = #{templateId},
        </if>
        <if test="templateName !=null and templateName !='' ">
            templateName = #{templateName},
        </if>
        <if test="taskCount !=null and taskCount !='' ">
            taskCount = #{taskCount},
        </if>
        <if test="businessDomain !=null and businessDomain !='' ">
            businessDomain = #{businessDomain},
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            createdBy = #{createdBy},
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
            updatedBy = #{updatedBy},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        <if test="createdTime !=null and createdTime !='' ">
            createdTime = #{createdTime},
        </if>
        <if test="updatedTime !=null and updatedTime !='' ">
            updatedTime = #{updatedTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="drug !=null and drug !='' ">
            drug,
        </if>
        <if test="eventTag !=null and eventTag !='' ">
            eventTag,
        </if>
        <if test="templateId !=null and templateId !='' ">
            templateId,
        </if>
        <if test="templateName !=null and templateName !='' ">
            templateName,
        </if>
        <if test="taskCount !=null and taskCount !='' ">
            taskCount,
        </if>
        <if test="businessDomain !=null and businessDomain !='' ">
            businessDomain,
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            createdBy,
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
            updatedBy,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        <if test="createdTime !=null and createdTime !='' ">
            createdTime,
        </if>
        <if test="updatedTime !=null and updatedTime !='' ">
            updatedTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="drug !=null and drug !='' ">
             #{drug},
        </if>
        <if test="eventTag !=null and eventTag !='' ">
             #{eventTag},
        </if>
        <if test="templateId !=null and templateId !='' ">
             #{templateId},
        </if>
        <if test="templateName !=null and templateName !='' ">
             #{templateName},
        </if>
        <if test="taskCount !=null and taskCount !='' ">
             #{taskCount},
        </if>
        <if test="businessDomain !=null and businessDomain !='' ">
             #{businessDomain},
        </if>
        <if test="createdBy !=null and createdBy !='' ">
             #{createdBy},
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
             #{updatedBy},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        <if test="createdTime !=null and createdTime !='' ">
             #{createdTime},
        </if>
        <if test="updatedTime !=null and updatedTime !='' ">
             #{updatedTime},
        </if>
        </trim>

    </insert>

</mapper>
