TRiskManagerMapper.xml 4.21 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
<?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.TRiskManagerMapper">
    
    <resultMap type="TRiskManager" id="TRiskManagerResult">
        <result property="id"    column="id"    />
        <result property="riskPart"    column="risk_part"    />
        <result property="riskContent"    column="risk_content"    />
        <result property="riskLevel"    column="risk_level"    />
        <result property="riskType"    column="risk_type"    />
        <result property="riskControl"    column="risk_control"    />
        <result property="riskDept"    column="risk_dept"    />
        <result property="riskPerson"    column="risk_person"    />
    </resultMap>

    <sql id="selectTRiskManagerVo">
        select id, risk_part, risk_content, risk_level, risk_type, risk_control, risk_dept, risk_person from t_risk_manager
    </sql>

    <select id="selectTRiskManagerList" parameterType="TRiskManager" resultMap="TRiskManagerResult">
        <include refid="selectTRiskManagerVo"/>
        <where>  
            <if test="riskPart != null  and riskPart != ''"> and risk_part = #{riskPart}</if>
            <if test="riskContent != null  and riskContent != ''"> and risk_content = #{riskContent}</if>
            <if test="riskLevel != null  and riskLevel != ''"> and risk_level = #{riskLevel}</if>
            <if test="riskType != null  and riskType != ''"> and risk_type = #{riskType}</if>
            <if test="riskControl != null  and riskControl != ''"> and risk_control = #{riskControl}</if>
            <if test="riskDept != null  and riskDept != ''"> and risk_dept = #{riskDept}</if>
            <if test="riskPerson != null  and riskPerson != ''"> and risk_person = #{riskPerson}</if>
        </where>
    </select>
    
    <select id="selectTRiskManagerById" parameterType="Long" resultMap="TRiskManagerResult">
        <include refid="selectTRiskManagerVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTRiskManager" parameterType="TRiskManager" useGeneratedKeys="true" keyProperty="id">
        insert into t_risk_manager
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="riskPart != null">risk_part,</if>
            <if test="riskContent != null">risk_content,</if>
            <if test="riskLevel != null">risk_level,</if>
            <if test="riskType != null">risk_type,</if>
            <if test="riskControl != null">risk_control,</if>
            <if test="riskDept != null">risk_dept,</if>
            <if test="riskPerson != null">risk_person,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="riskPart != null">#{riskPart},</if>
            <if test="riskContent != null">#{riskContent},</if>
            <if test="riskLevel != null">#{riskLevel},</if>
            <if test="riskType != null">#{riskType},</if>
            <if test="riskControl != null">#{riskControl},</if>
            <if test="riskDept != null">#{riskDept},</if>
            <if test="riskPerson != null">#{riskPerson},</if>
         </trim>
    </insert>

    <update id="updateTRiskManager" parameterType="TRiskManager">
        update t_risk_manager
        <trim prefix="SET" suffixOverrides=",">
            <if test="riskPart != null">risk_part = #{riskPart},</if>
            <if test="riskContent != null">risk_content = #{riskContent},</if>
            <if test="riskLevel != null">risk_level = #{riskLevel},</if>
            <if test="riskType != null">risk_type = #{riskType},</if>
            <if test="riskControl != null">risk_control = #{riskControl},</if>
            <if test="riskDept != null">risk_dept = #{riskDept},</if>
            <if test="riskPerson != null">risk_person = #{riskPerson},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTRiskManagerById" parameterType="Long">
        delete from t_risk_manager where id = #{id}
    </delete>

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