<?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.siwei.rsmonitoring.mapper.TDkAuditflowRecordFjMapper">
    
    <resultMap type="TDkAuditflowRecordFj" id="TDkAuditflowRecordFjResult">
        <result property="id"    column="id"    />
        <result property="recordId"    column="record_id"    />
        <result property="fjId"    column="fj_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="state"    column="state"    />
    </resultMap>

    <sql id="selectTDkAuditflowRecordFjVo">
        select id, record_id, fj_id, create_time, create_by, update_by, update_time, state from t_dk_auditflow_record_fj
    </sql>

    <select id="selectTDkAuditflowRecordFjList" parameterType="TDkAuditflowRecordFj" resultMap="TDkAuditflowRecordFjResult">
        <include refid="selectTDkAuditflowRecordFjVo"/>
        <where>  
            <if test="recordId != null  and recordId != ''"> and record_id = #{recordId}</if>
            <if test="fjId != null  and fjId != ''"> and fj_id = #{fjId}</if>
            <if test="state != null  and state != ''"> and state = #{state}</if>
        </where>
    </select>
    
    <select id="selectTDkAuditflowRecordFjById" parameterType="String" resultMap="TDkAuditflowRecordFjResult">
        <include refid="selectTDkAuditflowRecordFjVo"/>
        where id = #{id}
    </select>

    <insert id="insertTDkAuditflowRecordFj" parameterType="TDkAuditflowRecordFj">
        insert into t_dk_auditflow_record_fj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">id,</if>
            <if test="recordId != null and recordId != ''">record_id,</if>
            <if test="fjId != null">fj_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="state != null">state,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">#{id},</if>
            <if test="recordId != null and recordId != ''">#{recordId},</if>
            <if test="fjId != null">#{fjId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="state != null">#{state},</if>
         </trim>
    </insert>

    <update id="updateTDkAuditflowRecordFj" parameterType="TDkAuditflowRecordFj">
        update t_dk_auditflow_record_fj
        <trim prefix="SET" suffixOverrides=",">
            <if test="recordId != null and recordId != ''">record_id = #{recordId},</if>
            <if test="fjId != null">fj_id = #{fjId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="state != null">state = #{state},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkAuditflowRecordFjById" parameterType="String">
        delete from t_dk_auditflow_record_fj where id = #{id}
    </delete>

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