<?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.TIssueRectificationMapper">

    <resultMap type="com.zehong.system.domain.TIssueRectification" id="TIssueRectificationResult">
        <result property="id"    column="id"    />
        <result property="fRiskDevMajInforId"    column="f_risk_dev_maj_infor_id"    />
        <result property="dangerAnomaly"    column="danger_anomaly"    />
        <result property="rectificationDisposal"    column="rectification_disposal"    />
        <result property="handler"    column="handler"    />
        <result property="phone"    column="phone"    />
        <result property="issueType"    column="issue_type"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectTIssueRectificationVo">
        select id, f_risk_dev_maj_infor_id, danger_anomaly, rectification_disposal, handler, phone, issue_type, create_time from t_issue_rectification
    </sql>

    <select id="selectTIssueRectificationList" parameterType="com.zehong.system.domain.TIssueRectification" resultMap="TIssueRectificationResult">
        <include refid="selectTIssueRectificationVo"/>
        <where>
            <if test="fRiskDevMajInforId != null "> and f_risk_dev_maj_infor_id = #{fRiskDevMajInforId}</if>
            <if test="handler != null  and handler != ''"> and handler = #{handler}</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="issueType != null  and issueType != ''"> and issue_type = #{issueType}</if>
        </where>
    </select>

    <select id="selectTIssueRectificationById" parameterType="Long" resultMap="TIssueRectificationResult">
        <include refid="selectTIssueRectificationVo"/>
        where id = #{id}
    </select>

    <insert id="insertTIssueRectification" parameterType="com.zehong.system.domain.TIssueRectification" useGeneratedKeys="true" keyProperty="id">
        insert into t_issue_rectification
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fRiskDevMajInforId != null">f_risk_dev_maj_infor_id,</if>
            <if test="dangerAnomaly != null">danger_anomaly,</if>
            <if test="rectificationDisposal != null">rectification_disposal,</if>
            <if test="handler != null">handler,</if>
            <if test="phone != null">phone,</if>
            <if test="issueType != null">issue_type,</if>
            <if test="createTime != null">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fRiskDevMajInforId != null">#{fRiskDevMajInforId},</if>
            <if test="dangerAnomaly != null">#{dangerAnomaly},</if>
            <if test="rectificationDisposal != null">#{rectificationDisposal},</if>
            <if test="handler != null">#{handler},</if>
            <if test="phone != null">#{phone},</if>
            <if test="issueType != null">#{issueType},</if>
            <if test="createTime != null">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateTIssueRectification" parameterType="com.zehong.system.domain.TIssueRectification">
        update t_issue_rectification
        <trim prefix="SET" suffixOverrides=",">
            <if test="fRiskDevMajInforId != null">f_risk_dev_maj_infor_id = #{fRiskDevMajInforId},</if>
            <if test="dangerAnomaly != null">danger_anomaly = #{dangerAnomaly},</if>
            <if test="rectificationDisposal != null">rectification_disposal = #{rectificationDisposal},</if>
            <if test="handler != null">handler = #{handler},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="issueType != null">issue_type = #{issueType},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTIssueRectificationById" parameterType="Long">
        delete from t_issue_rectification where id = #{id}
    </delete>

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