<?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="com.ruoyi.system.mapper.TdNotifyMapper">
    
    <resultMap type="TdNotify" id="TdNotifyResult">
        <result property="notifyId"    column="notify_id"    />
        <result property="notifyUser"    column="notify_user"    />
        <result property="notifyDepart"    column="notify_depart"    />
        <result property="notifyTime"    column="notify_time"    />
        <result property="notifyContent"    column="notify_content"    />
        <result property="notifyBeuser"    column="notify_beuser"    />
        <result property="notifyState"    column="notify_state"    />
        <result property="framework"    column="framework"    />
        <result property="area"    column="area"    />
    </resultMap>

    <sql id="selectTdNotifyVo">
        select notify_id, notify_user, notify_depart, notify_time, notify_content, notify_beuser, notify_state, framework, area from td_notify
    </sql>

    <select id="selectTdNotifyList" parameterType="TdNotify" resultMap="TdNotifyResult">
        <include refid="selectTdNotifyVo"/>
        <where>  
            <if test="notifyUser != null  and notifyUser != ''"> and notify_user = #{notifyUser}</if>
            <if test="notifyDepart != null  and notifyDepart != ''"> and notify_depart = #{notifyDepart}</if>
            <if test="notifyTime != null "> and notify_time = #{notifyTime}</if>
            <if test="notifyContent != null  and notifyContent != ''"> and notify_content = #{notifyContent}</if>
            <if test="notifyBeuser != null  and notifyBeuser != ''"> and notify_beuser = #{notifyBeuser}</if>
            <if test="notifyState != null  and notifyState != ''"> and notify_state = #{notifyState}</if>
            <if test="framework != null  and framework != ''"> and framework = #{framework}</if>
            <if test="area != null  and area != ''"> and area = #{area}</if>
        </where>
    </select>
    
    <select id="selectTdNotifyByNotifyId" parameterType="Long" resultMap="TdNotifyResult">
        <include refid="selectTdNotifyVo"/>
        where notify_id = #{notifyId}
    </select>
        
    <insert id="insertTdNotify" parameterType="TdNotify" useGeneratedKeys="true" keyProperty="notifyId">
        insert into td_notify
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="notifyUser != null">notify_user,</if>
            <if test="notifyDepart != null">notify_depart,</if>
            <if test="notifyTime != null">notify_time,</if>
            <if test="notifyContent != null">notify_content,</if>
            <if test="notifyBeuser != null">notify_beuser,</if>
            <if test="notifyState != null">notify_state,</if>
            <if test="framework != null">framework,</if>
            <if test="area != null">area,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="notifyUser != null">#{notifyUser},</if>
            <if test="notifyDepart != null">#{notifyDepart},</if>
            <if test="notifyTime != null">#{notifyTime},</if>
            <if test="notifyContent != null">#{notifyContent},</if>
            <if test="notifyBeuser != null">#{notifyBeuser},</if>
            <if test="notifyState != null">#{notifyState},</if>
            <if test="framework != null">#{framework},</if>
            <if test="area != null">#{area},</if>
         </trim>
    </insert>

    <update id="updateTdNotify" parameterType="TdNotify">
        update td_notify
        <trim prefix="SET" suffixOverrides=",">
            <if test="notifyUser != null">notify_user = #{notifyUser},</if>
            <if test="notifyDepart != null">notify_depart = #{notifyDepart},</if>
            <if test="notifyTime != null">notify_time = #{notifyTime},</if>
            <if test="notifyContent != null">notify_content = #{notifyContent},</if>
            <if test="notifyBeuser != null">notify_beuser = #{notifyBeuser},</if>
            <if test="notifyState != null">notify_state = #{notifyState},</if>
            <if test="framework != null">framework = #{framework},</if>
            <if test="area != null">area = #{area},</if>
        </trim>
        where notify_id = #{notifyId}
    </update>

    <delete id="deleteTdNotifyByNotifyId" parameterType="Long">
        delete from td_notify where notify_id = #{notifyId}
    </delete>

    <delete id="deleteTdNotifyByNotifyIds" parameterType="String">
        delete from td_notify where notify_id in 
        <foreach item="notifyId" collection="array" open="(" separator="," close=")">
            #{notifyId}
        </foreach>
    </delete>

</mapper>