<?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.srs.routine.mapper.RtFuAuditMapper">

    <resultMap type="RtFuAudit" id="RtFuAuditResult">
        <result property="id"    column="id"    />
        <result property="reNo"    column="re_no"    />
        <result property="auStatus"    column="au_status"    />
        <result property="reason"    column="reason"    />
        <result property="auditor"    column="auditor"    />
        <result property="depart"    column="depart"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectRtFuAuditVo">
        select id, re_no, au_status, reason, auditor, depart, create_time, update_time from rt_fu_audit
    </sql>

    <select id="selectRtFuAuditList" parameterType="RtFuAudit" resultMap="RtFuAuditResult">
        <include refid="selectRtFuAuditVo"/>
        <where>
            <if test="reNo != null  and reNo != ''"> and re_no = #{reNo}</if>
            <if test="auStatus != null  and auStatus != ''"> and au_status = #{auStatus}</if>
            <if test="reason != null  and reason != ''"> and reason = #{reason}</if>
            <if test="auditor != null  and auditor != ''"> and auditor = #{auditor}</if>
            <if test="depart != null  and depart != ''"> and depart = #{depart}</if>
        </where>
    </select>

    <select id="selectRtFuAuditById" parameterType="Long" resultMap="RtFuAuditResult">
        <include refid="selectRtFuAuditVo"/>
        where id = #{id}
    </select>
    <select id="selectRtFuAuditByre" parameterType="string" resultType="com.srs.routine.domain.vo.RtFuAuditVo">
        <include refid="selectRtFuAuditVo"/>
        where re_no = #{reNo}
    </select>

    <insert id="insertRtFuAudit" parameterType="RtFuAudit" useGeneratedKeys="true" keyProperty="id">
        insert into rt_fu_audit
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="reNo != null">re_no,</if>
            <if test="auStatus != null">au_status,</if>
            <if test="reason != null">reason,</if>
            <if test="auditor != null">auditor,</if>
            <if test="depart != null">depart,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="reNo != null">#{reNo},</if>
            <if test="auStatus != null">#{auStatus},</if>
            <if test="reason != null">#{reason},</if>
            <if test="auditor != null">#{auditor},</if>
            <if test="depart != null">#{depart},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateRtFuAudit" parameterType="RtFuAudit">
        update rt_fu_audit
        <trim prefix="SET" suffixOverrides=",">
            <if test="reNo != null">re_no = #{reNo},</if>
            <if test="auStatus != null">au_status = #{auStatus},</if>
            <if test="reason != null">reason = #{reason},</if>
            <if test="auditor != null">auditor = #{auditor},</if>
            <if test="depart != null">depart = #{depart},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteRtFuAuditByaure" parameterType="string">
        delete from rt_fu_audit where re_no = #{reNo}
    </delete>

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