<?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.TDkjbxxStateMapper">
    
    <resultMap type="TDkjbxxState" id="TDkjbxxStateResult">
        <result property="id"    column="id"    />
        <result property="auditflow"    column="auditflow"    />
        <result property="stepCode"    column="step_code"    />
        <result property="operationBy"    column="operation_by"    />
        <result property="operationTime"    column="operation_time"    />
        <result property="operationId"    column="operation_id"    />
        <result property="successType"    column="success_type"    />
    </resultMap>

    <sql id="selectTDkjbxxStateVo">
        select id, auditflow, step_code, operation_by, operation_time, operation_id ,success_type from t_dkjbxx_state
    </sql>

    <select id="selectTDkjbxxStateList" parameterType="TDkjbxxState" resultMap="TDkjbxxStateResult">
        <include refid="selectTDkjbxxStateVo"/>
        <where>  
            <if test="auditflow != null  and auditflow != ''"> and auditflow = #{auditflow}</if>
            <if test="stepCode != null  and stepCode != ''"> and step_code = #{stepCode}</if>
            <if test="operationBy != null  and operationBy != ''"> and operation_by = #{operationBy}</if>
            <if test="operationTime != null  and operationTime != ''"> and operation_time = #{operationTime}</if>
            <if test="operationId != null  and operationId != ''"> and operation_id = #{operationId}</if>
            <if test="successType != null  and successType != ''"> and success_type = #{successType}</if>
        </where>
    </select>
    
    <select id="selectTDkjbxxStateById" parameterType="String" resultMap="TDkjbxxStateResult">
        <include refid="selectTDkjbxxStateVo"/>
        where id = #{id}
    </select>

    <insert id="insertTDkjbxxState" parameterType="TDkjbxxState">
        insert into t_dkjbxx_state
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="auditflow != null and auditflow != ''">auditflow,</if>
            <if test="stepCode != null and stepCode != ''">step_code,</if>
            <if test="operationBy != null">operation_by,</if>
            <if test="operationTime != null">operation_time,</if>
            <if test="operationId != null">operation_id,</if>
            <if test="successType != null  and successType != ''">success_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="auditflow != null and auditflow != ''">#{auditflow},</if>
            <if test="stepCode != null and stepCode != ''">#{stepCode},</if>
            <if test="operationBy != null">#{operationBy},</if>
            <if test="operationTime != null">#{operationTime},</if>
            <if test="operationId != null">#{operationId},</if>
            <if test="successType != null  and successType != ''"> #{successType},</if>
         </trim>
    </insert>

    <update id="updateTDkjbxxState" parameterType="TDkjbxxState">
        update t_dkjbxx_state
        <trim prefix="SET" suffixOverrides=",">
            <if test="auditflow != null and auditflow != ''">auditflow = #{auditflow},</if>
            <if test="stepCode != null and stepCode != ''">step_code = #{stepCode},</if>
            <if test="operationBy != null">operation_by = #{operationBy},</if>
            <if test="operationTime != null">operation_time = #{operationTime},</if>
            <if test="operationId != null">operation_id = #{operationId},</if>
            <if test="successType != null  and successType != ''">success_type = #{successType},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkjbxxStateById" parameterType="String">
        delete from t_dkjbxx_state where id = #{id}
    </delete>

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