zxl
2025-06-24 3b0516a2959e25576e4f3fda697a3b025d06c8c9
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?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.CheckTemplateMapper">
 
    <resultMap type="com.ycl.platform.domain.entity.CheckTemplate" id="CheckTemplateResult">
        <result property="id"    column="id"    />
        <result property="templateName"    column="template_name"    />
        <result property="adjustCoefficient"    column="adjust_coefficient"    />
        <result property="adjustWay"    column="adjust_way"    />
        <result property="examineCategory"    column="examine_category"    />
        <result property="examineTag"    column="examine_tag"    />
        <result property="jobId"    column="job_id"    />
        <result property="status"    column="status"    />
        <result property="deptId"    column="dept_id"    />
        <result property="frequency"    column="frequency"    />
        <result property="alarmScore"    column="alarm_score"    />
        <result property="description"    column="description"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="createUserName"    column="create_user_name"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateUserName"    column="update_user_name"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>
 
    <sql id="selectCheckTemplateVo">
        select id, template_name, adjust_coefficient, adjust_way, examine_category,examine_tag, status, dept_id, create_time, update_time, create_user, create_user_name, update_user, update_user_name,
               description,frequency,alarm_score,job_id,deleted from t_check_template
    </sql>
 
    <select id="selectCheckTemplateList" resultMap="CheckTemplateResult">
        <include refid="selectCheckTemplateVo"/>
        <where>
            deleted =0
            <if test="templateName != null  and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
            <if test="examineCategory != null "> and examine_category = #{examineCategory}</if>
            <if test="examineTag != null "> and examine_tag = #{examineTag}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
        order by examine_tag DESC, examine_category , create_time
    </select>
 
    <select id="selectCheckTemplateById" resultMap="CheckTemplateResult">
        <include refid="selectCheckTemplateVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertCheckTemplate" useGeneratedKeys="true" keyProperty="id">
        insert into t_check_template
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="templateName != null and templateName != ''">template_name,</if>
            <if test="adjustCoefficient != null">adjust_coefficient,</if>
            <if test="adjustWay != null and adjustWay != ''">adjust_way,</if>
            <if test="examineCategory != null">examine_category,</if>
            <if test="examineTag != null">examine_tag,</if>
            <if test="status != null">status,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="frequency != null">frequency,</if>
            <if test="alarmScore != null">alarm_score,</if>
            <if test="description != null">description,</if>
            <if test="jobId != null">job_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createUserName != null">create_user_name,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateUserName != null">update_user_name,</if>
            <if test="deleted != null">deleted,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="templateName != null and templateName != ''">#{templateName},</if>
            <if test="adjustCoefficient != null">#{adjustCoefficient},</if>
            <if test="adjustWay != null and adjustWay != ''">#{adjustWay},</if>
            <if test="examineCategory != null">#{examineCategory},</if>
            <if test="examineTag != null">#{examineTag},</if>
            <if test="status != null">#{status},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="frequency != null">#{frequency},</if>
            <if test="alarmScore != null">#{alarmScore},</if>
            <if test="description != null">#{description},</if>
            <if test="jobId != null">#{jobId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createUserName != null">#{createUserName},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateUserName != null">#{updateUserName},</if>
            <if test="deleted != null">#{deleted},</if>
         </trim>
    </insert>
 
    <update id="updateCheckTemplate">
        update t_check_template
        <trim prefix="SET" suffixOverrides=",">
            <if test="templateName != null and templateName != ''">template_name = #{templateName},</if>
            <if test="adjustCoefficient != null">adjust_coefficient = #{adjustCoefficient},</if>
            <if test="adjustWay != null and adjustWay != ''">adjust_way = #{adjustWay},</if>
            <if test="examineCategory != null">examine_category = #{examineCategory},</if>
            <if test="examineTag != null">examine_tag = #{examineTag},</if>
            <if test="status != null">status = #{status},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="jobId != null">job_id = #{jobId},</if>
            <if test="frequency != null">frequency = #{frequency},</if>
            <if test="alarmScore != null">alarm_score = #{alarmScore},</if>
            <if test="description != null">description = #{description},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createUserName != null">create_user_name = #{createUserName},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateUserName != null">update_user_name = #{updateUserName},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteCheckTemplateById">
        update t_check_template set deleted = 1 where id = #{id}
    </update>
 
    <delete id="deleteCheckTemplateByIds" parameterType="String">
        delete from t_check_template where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
 
</mapper>