<?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.zehong.system.mapper.TComplainDealManSysSetMapper">

    <resultMap type="TComplainDealManSysSet" id="TComplainDealManSysSetResult">
        <result property="fComplainDealManSysSetId"    column="f_complain_deal_man_sys_set_id"    />
        <result property="fType"    column="f_type"    />
        <result property="fDay"    column="f_day"    />
        <result property="fHours"    column="f_hours"    />
        <result property="fMinutes"    column="f_minutes"    />
        <result property="fSeconds"    column="f_seconds"    />
        <result property="fRemarks"    column="f_remarks"    />
    </resultMap>

    <sql id="selectTComplainDealManSysSetVo">
        select f_complain_deal_man_sys_set_id, f_type, f_day, f_hours, f_minutes, f_seconds, f_remarks from t_complain_deal_man_sys_set
    </sql>

    <select id="selectTComplainDealManSysSetList" parameterType="TComplainDealManSysSet" resultMap="TComplainDealManSysSetResult">
        <include refid="selectTComplainDealManSysSetVo"/>
        <where>
            <if test="fType != null  and fType != ''"> and f_type = #{fType}</if>
            <if test="fDay != null "> and f_day = #{fDay}</if>
            <if test="fHours != null "> and f_hours = #{fHours}</if>
            <if test="fMinutes != null "> and f_minutes = #{fMinutes}</if>
            <if test="fSeconds != null "> and f_seconds = #{fSeconds}</if>
            <if test="fRemarks != null  and fRemarks != ''"> and f_remarks = #{fRemarks}</if>
        </where>
        order by f_complain_deal_man_sys_set_id asc
    </select>

    <select id="selectTComplainDealManSysSetById" parameterType="Long" resultMap="TComplainDealManSysSetResult">
        <include refid="selectTComplainDealManSysSetVo"/>
        where f_complain_deal_man_sys_set_id = #{fComplainDealManSysSetId}
    </select>

    <insert id="insertTComplainDealManSysSet" parameterType="TComplainDealManSysSet" useGeneratedKeys="true" keyProperty="fComplainDealManSysSetId">
        insert into t_complain_deal_man_sys_set
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fType != null and fType != ''">f_type,</if>
            <if test="fDay != null">f_day,</if>
            <if test="fHours != null">f_hours,</if>
            <if test="fMinutes != null">f_minutes,</if>
            <if test="fSeconds != null">f_seconds,</if>
            <if test="fRemarks != null">f_remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fType != null and fType != ''">#{fType},</if>
            <if test="fDay != null">#{fDay},</if>
            <if test="fHours != null">#{fHours},</if>
            <if test="fMinutes != null">#{fMinutes},</if>
            <if test="fSeconds != null">#{fSeconds},</if>
            <if test="fRemarks != null">#{fRemarks},</if>
        </trim>
    </insert>

    <update id="updateTComplainDealManSysSet" parameterType="TComplainDealManSysSet">
        update t_complain_deal_man_sys_set
        <trim prefix="SET" suffixOverrides=",">
            <if test="fType != null and fType != ''">f_type = #{fType},</if>
            <if test="fDay != null">f_day = #{fDay},</if>
            <if test="fHours != null">f_hours = #{fHours},</if>
            <if test="fMinutes != null">f_minutes = #{fMinutes},</if>
            <if test="fSeconds != null">f_seconds = #{fSeconds},</if>
            <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
        </trim>
        where f_complain_deal_man_sys_set_id = #{fComplainDealManSysSetId}
    </update>
    <update id="batchUpdate" parameterType="list">
        <foreach collection="complainDealManSysSets" item="item" separator=";">
            UPDATE t_complain_deal_man_sys_set
            SET f_day = #{item.fDay},
                f_hours = #{item.fHours},
                f_minutes = #{item.fMinutes},
                f_seconds = #{item.fSeconds},
            f_remarks = #{item.fRemarks}
            WHERE f_complain_deal_man_sys_set_id = #{item.fComplainDealManSysSetId}
        </foreach>
    </update>

    <delete id="deleteTComplainDealManSysSetById" parameterType="Long">
        delete from t_complain_deal_man_sys_set where f_complain_deal_man_sys_set_id = #{fComplainDealManSysSetId}
    </delete>

    <delete id="deleteTComplainDealManSysSetByIds" parameterType="String">
        delete from t_complain_deal_man_sys_set where f_complain_deal_man_sys_set_id in
        <foreach item="fComplainDealManSysSetId" collection="array" open="(" separator="," close=")">
            #{fComplainDealManSysSetId}
        </foreach>
    </delete>
</mapper>