<?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.TDkAuditflowTypeMapper">
    
    <resultMap type="TDkAuditflowType" id="TDkAuditflowTypeResult">
        <result property="id"    column="id"    />
        <result property="auditflowCode"    column="auditflow_code"    />
        <result property="auditflowValue"    column="auditflow_value"    />
        <result property="sort"    column="sort"    />
    </resultMap>

    <sql id="selectTDkAuditflowTypeVo">
        select id, auditflow_code, auditflow_value, sort from t_dk_auditflow_type
    </sql>

    <select id="selectTDkAuditflowTypeList" parameterType="TDkAuditflowType" resultMap="TDkAuditflowTypeResult">
        <include refid="selectTDkAuditflowTypeVo"/>
        <where>  
            <if test="auditflowCode != null  and auditflowCode != ''"> and auditflow_code = #{auditflowCode}</if>
            <if test="auditflowValue != null  and auditflowValue != ''"> and auditflow_value = #{auditflowValue}</if>
            <if test="sort != null "> and sort = #{sort}</if>
        </where>
        order by sort asc
    </select>
    
    <select id="selectTDkAuditflowTypeById" parameterType="String" resultMap="TDkAuditflowTypeResult">
        <include refid="selectTDkAuditflowTypeVo"/>
        where id = #{id}
    </select>

    <insert id="insertTDkAuditflowType" parameterType="TDkAuditflowType">
        insert into t_dk_auditflow_type
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">id,</if>
            <if test="auditflowCode != null and auditflowCode != ''">auditflow_code,</if>
            <if test="auditflowValue != null">auditflow_value,</if>
            <if test="sort != null">sort,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">#{id},</if>
            <if test="auditflowCode != null and auditflowCode != ''">#{auditflowCode},</if>
            <if test="auditflowValue != null">#{auditflowValue},</if>
            <if test="sort != null">#{sort},</if>
         </trim>
    </insert>

    <update id="updateTDkAuditflowType" parameterType="TDkAuditflowType">
        update t_dk_auditflow_type
        <trim prefix="SET" suffixOverrides=",">
            <if test="auditflowCode != null and auditflowCode != ''">auditflow_code = #{auditflowCode},</if>
            <if test="auditflowValue != null">auditflow_value = #{auditflowValue},</if>
            <if test="sort != null">sort = #{sort},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkAuditflowTypeById" parameterType="String">
        delete from t_dk_auditflow_type where id = #{id}
    </delete>

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