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

    <select id="selectSDtpYypzFaqManagementList" parameterType="pd" resultType="pd">
        select * from s_dtp_yypz_faq_management where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="questionAnswerId !=null and questionAnswerId !='' ">
            and questionAnswerId = #{questionAnswerId}
        </if>
        <if test="questionAnswerType !=null and questionAnswerType !='' ">
            and questionAnswerType = #{questionAnswerType}
        </if>
        <if test="summary !=null and summary !='' ">
            and summary = #{summary}
        </if>
        <if test="questionContent !=null and questionContent !='' ">
            and questionContent = #{questionContent}
        </if>
        <if test="answerContent !=null and answerContent !='' ">
            and answerContent = #{answerContent}
        </if>
        <if test="applicableDrugs !=null and applicableDrugs !='' ">
            and applicableDrugs = #{applicableDrugs}
        </if>
        <if test="sortWeight !=null and sortWeight !='' ">
            and sortWeight = #{sortWeight}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
            and lastEditTime = #{lastEditTime}
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
            and lastEditor = #{lastEditor}
        </if>
    </select>


    <update id="updateSDtpYypzFaqManagement" parameterType="pd" >
        update s_dtp_yypz_faq_management
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="questionAnswerId !=null and questionAnswerId !='' ">
            questionAnswerId = #{questionAnswerId},
        </if>
        <if test="questionAnswerType !=null and questionAnswerType !='' ">
            questionAnswerType = #{questionAnswerType},
        </if>
        <if test="summary !=null and summary !='' ">
            summary = #{summary},
        </if>
        <if test="questionContent !=null and questionContent !='' ">
            questionContent = #{questionContent},
        </if>
        <if test="answerContent !=null and answerContent !='' ">
            answerContent = #{answerContent},
        </if>
        <if test="applicableDrugs !=null and applicableDrugs !='' ">
            applicableDrugs = #{applicableDrugs},
        </if>
        <if test="sortWeight !=null and sortWeight !='' ">
            sortWeight = #{sortWeight},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
            lastEditTime = #{lastEditTime},
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
            lastEditor = #{lastEditor},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="questionAnswerId !=null and questionAnswerId !='' ">
            questionAnswerId,
        </if>
        <if test="questionAnswerType !=null and questionAnswerType !='' ">
            questionAnswerType,
        </if>
        <if test="summary !=null and summary !='' ">
            summary,
        </if>
        <if test="questionContent !=null and questionContent !='' ">
            questionContent,
        </if>
        <if test="answerContent !=null and answerContent !='' ">
            answerContent,
        </if>
        <if test="applicableDrugs !=null and applicableDrugs !='' ">
            applicableDrugs,
        </if>
        <if test="sortWeight !=null and sortWeight !='' ">
            sortWeight,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
            lastEditTime,
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
            lastEditor,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="questionAnswerId !=null and questionAnswerId !='' ">
             #{questionAnswerId},
        </if>
        <if test="questionAnswerType !=null and questionAnswerType !='' ">
             #{questionAnswerType},
        </if>
        <if test="summary !=null and summary !='' ">
             #{summary},
        </if>
        <if test="questionContent !=null and questionContent !='' ">
             #{questionContent},
        </if>
        <if test="answerContent !=null and answerContent !='' ">
             #{answerContent},
        </if>
        <if test="applicableDrugs !=null and applicableDrugs !='' ">
             #{applicableDrugs},
        </if>
        <if test="sortWeight !=null and sortWeight !='' ">
             #{sortWeight},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
             #{lastEditTime},
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
             #{lastEditor},
        </if>
        </trim>

    </insert>

</mapper>
