xiangpei
2024-04-07 1d14ba39daf0422199c44b5b2ffc67d2364b2be2
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
<?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.ycl.platform.mapper.CheckTemplateRuleMapper">
    
    <resultMap type="com.ycl.platform.domain.entity.CheckTemplateRule" id="CheckTemplateRuleResult">
        <result property="id"    column="id"    />
        <result property="checkTemplateId"    column="check_template_id"    />
        <result property="checkRuleId"    column="check_rule_id"    />
        <result property="weight"    column="weight"    />
        <result property="maxScore"    column="max_score"    />
        <result property="auditState"    column="audit_state"    />
    </resultMap>
 
    <sql id="selectCheckTemplateRuleVo">
        select id, check_template_id, check_rule_id, weight, max_score, audit_state from t_check_template_rule
    </sql>
 
    <select id="selectCheckTemplateRuleList" resultMap="CheckTemplateRuleResult">
        <include refid="selectCheckTemplateRuleVo"/>
        <where>  
            <if test="checkTemplateId != null "> and check_template_id = #{checkTemplateId}</if>
            <if test="checkRuleId != null "> and check_rule_id = #{checkRuleId}</if>
            <if test="auditState != null "> and audit_state = #{auditState}</if>
        </where>
    </select>
    
    <select id="selectCheckTemplateRuleById" resultMap="CheckTemplateRuleResult">
        <include refid="selectCheckTemplateRuleVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCheckTemplateRule" useGeneratedKeys="true" keyProperty="id">
        insert into t_check_template_rule
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="checkTemplateId != null">check_template_id,</if>
            <if test="checkRuleId != null">check_rule_id,</if>
            <if test="weight != null">weight,</if>
            <if test="maxScore != null">max_score,</if>
            <if test="auditState != null">audit_state,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="checkTemplateId != null">#{checkTemplateId},</if>
            <if test="checkRuleId != null">#{checkRuleId},</if>
            <if test="weight != null">#{weight},</if>
            <if test="maxScore != null">#{maxScore},</if>
            <if test="auditState != null">#{auditState},</if>
         </trim>
    </insert>
 
    <update id="updateCheckTemplateRule">
        update t_check_template_rule
        <trim prefix="SET" suffixOverrides=",">
            <if test="checkTemplateId != null">check_template_id = #{checkTemplateId},</if>
            <if test="checkRuleId != null">check_rule_id = #{checkRuleId},</if>
            <if test="weight != null">weight = #{weight},</if>
            <if test="maxScore != null">max_score = #{maxScore},</if>
            <if test="auditState != null">audit_state = #{auditState},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteCheckTemplateRuleById">
        delete from t_check_template_rule where id = #{id}
    </delete>
 
    <delete id="deleteCheckTemplateRuleByIds">
        delete from t_check_template_rule where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>