双重预防项目-国泰新华二开定制版
16639036659
2024-06-12 a178e841dce630b39e6fada786df51b50b4c9506
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?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.ruoyi.project.tr.riskList.mapper.RiskListMapper">
    
    <resultMap type="com.ruoyi.project.tr.riskList.domain.RiskList" id="RiskListResult">
        <result property="riskListId"    column="risk_list_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="riskListNum"    column="risk_list_num"    />
        <result property="riskListName"    column="risk_list_name"    />
        <result property="riskListIsSpecial"    column="risk_list_is_special"    />
        <result property="riskListImgUrl"    column="risk_list_img_url"    />
        <result property="riskListDeviceType"    column="risk_list_device_type"    />
        <result property="riskListDeviceModel"    column="risk_list_device_model"    />
        <result property="riskListWorkType"    column="risk_list_work_type"    />
        <result property="riskListWorkFrequency"    column="risk_list_work_frequency"    />
        <result property="riskListCraftsType"    column="risk_list_crafts_type"    />
        <result property="riskListCraftsDescription"    column="risk_list_crafts_description"    />
        <result property="regionId"    column="region_id"    />
        <result property="regionName"    column="region_name"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="riskTypeName"    column="risk_type_name"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="riskType"    column="risk_type"    />
        <result property="companyId"    column="company_id"    />
        <result property="isEvaluation"    column="is_evaluation"    />
    </resultMap>
 
    <resultMap type="com.ruoyi.project.tr.riskList.domain.RiskListByCrafts" id="CraftsResult">
        <result property="riskListId"    column="risk_list_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="riskListNum"    column="risk_list_num"    />
        <result property="riskListName"    column="risk_list_name"    />
        <result property="riskListIsSpecial"    column="risk_list_is_special"    />
        <result property="riskListCraftsDescription"    column="risk_list_crafts_description"    />
        <result property="regionName"    column="region_name"    />
        <result property="deptName"    column="dept_name"    />
        <result property="userName"    column="user_name"    />
    </resultMap>
 
    <resultMap type="com.ruoyi.project.tr.riskList.domain.RiskListByDevice" id="DeviceResult">
        <result property="riskListId"    column="risk_list_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="riskListNum"    column="risk_list_num"    />
        <result property="riskListName"    column="risk_list_name"    />
        <result property="riskListIsSpecial"    column="risk_list_is_special"    />
        <result property="riskListDeviceModel"    column="risk_list_device_model"    />
        <result property="regionName"    column="region_name"    />
        <result property="deptName"    column="dept_name"    />
        <result property="riskTypeName"    column="risk_type_name"    />
        <result property="userName"    column="user_name"    />
    </resultMap>
 
    <resultMap type="com.ruoyi.project.tr.riskList.domain.RiskListByWork" id="WorkResult">
        <result property="riskListId"    column="risk_list_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="riskListNum"    column="risk_list_num"    />
        <result property="riskListName"    column="risk_list_name"    />
        <result property="riskListIsSpecial"    column="risk_list_is_special"    />
        <result property="riskListWorkFrequency"    column="risk_list_work_frequency"    />
        <result property="regionName"    column="region_name"    />
        <result property="deptName"    column="dept_name"    />
        <result property="userName"    column="user_name"    />
        <result property="riskTypeName"    column="risk_type_name"    />
    </resultMap>
 
 
    <sql id="selectRiskListVo">
        SELECT trl.risk_list_id, trl.create_by, trl.create_time, trl.update_by,
        trl.update_time, trl.remark, trl.risk_list_num, trl.risk_list_name,
        trl.risk_list_is_special, trl.risk_list_img_url, trl.risk_list_device_type,
        trl.risk_list_device_model, trl.risk_list_work_type, trl.risk_list_work_frequency,
        trl.risk_list_crafts_type, trl.risk_list_crafts_description, trl.region_id,tr.region_name,
        trl.dept_id, su.user_name, trl.user_id, sd.dept_name, trl.risk_type, trl.company_id,trt.risk_type_name,
        (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) AS is_evaluation
        FROM tr_risk_list trl
        LEFT JOIN sys_user su ON trl.user_id = su.user_id
        LEFT JOIN sys_dept sd ON trl.dept_id = sd.dept_id
        LEFT JOIN tr_region tr ON trl.region_id = tr.region_id
        LEFT JOIN tr_risk_type trt ON (trl.risk_list_device_type = trt.risk_type_id OR trl.risk_list_work_type = trt.risk_type_id OR trl.risk_list_crafts_type = trt.risk_type_id)
 
    </sql>
 
    <select id="selectRiskListList" parameterType="RiskList" resultMap="RiskListResult">
        <include refid="selectRiskListVo"/>
        <where>  
            <if test="riskListId != null "> and trl.risk_list_id = #{riskListId}</if>
            <if test="createBy != null  and createBy != ''"> and trl.create_by like concat('%', #{createBy}, '%')</if>
            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
             and trl.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
             </if>
            <if test="riskListNum != null  and riskListNum != ''"> and trl.risk_list_num = #{riskListNum}</if>
            <if test="riskListName != null  and riskListName != ''"> and trl.risk_list_name like concat('%', #{riskListName}, '%')</if>
            <if test="riskListIsSpecial != null "> and trl.risk_list_is_special = #{riskListIsSpecial}</if>
            <if test="riskListImgUrl != null  and riskListImgUrl != ''"> and trl.risk_list_img_url = #{riskListImgUrl}</if>
            <if test="riskListDeviceType != null "> and trl.risk_list_device_type = #{riskListDeviceType}</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''"> and trl.risk_list_device_model = #{riskListDeviceModel}</if>
            <if test="riskListWorkType != null "> and trl.risk_list_work_type = #{riskListWorkType}</if>
            <if test="riskListWorkFrequency != null "> and trl.risk_list_work_frequency = #{riskListWorkFrequency}</if>
            <if test="riskListCraftsType != null "> and trl.risk_list_crafts_type = #{riskListCraftsType}</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''"> and trl.risk_list_crafts_description = #{riskListCraftsDescription}</if>
            <if test="regionId != null  and regionId != ''"> and trl.region_id = #{regionId}</if>
            <if test="deptId != null "> and trl.dept_id = #{deptId}</if>
            <if test="userId != null "> and trl.user_id = #{userId}</if>
            <if test="riskType != null "> and trl.risk_type = #{riskType}</if>
            <if test="companyId != null "> and trl.company_id = #{companyId}</if>
            <if test="isEvaluation != null and isEvaluation == 0"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) = 0</if>
            <if test="isEvaluation != null and isEvaluation == 1"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) > 0</if>
 
            <if test="regionName != null  and regionName != ''"> and tr.region_name like concat('%', #{regionName}, '%')</if>
            <if test="deptName != null  and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
        </where>
    </select>
 
    <!--工艺节点 的导出查询-->
    <select id="selectRiskListByCrafts" parameterType="RiskList" resultMap="CraftsResult">
        <include refid="selectRiskListVo"/>
        <where>
            <if test="riskListId != null "> and trl.risk_list_id = #{riskListId}</if>
            <if test="createBy != null  and createBy != ''"> and trl.create_by like concat('%', #{createBy}, '%')</if>
            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
                and trl.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
            </if>
            <if test="riskListNum != null  and riskListNum != ''"> and trl.risk_list_num = #{riskListNum}</if>
            <if test="riskListName != null  and riskListName != ''"> and trl.risk_list_name like concat('%', #{riskListName}, '%')</if>
            <if test="riskListIsSpecial != null "> and trl.risk_list_is_special = #{riskListIsSpecial}</if>
            <if test="riskListImgUrl != null  and riskListImgUrl != ''"> and trl.risk_list_img_url = #{riskListImgUrl}</if>
            <if test="riskListDeviceType != null "> and trl.risk_list_device_type = #{riskListDeviceType}</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''"> and trl.risk_list_device_model = #{riskListDeviceModel}</if>
            <if test="riskListWorkType != null "> and trl.risk_list_work_type = #{riskListWorkType}</if>
            <if test="riskListWorkFrequency != null "> and trl.risk_list_work_frequency = #{riskListWorkFrequency}</if>
            <if test="riskListCraftsType != null "> and trl.risk_list_crafts_type = #{riskListCraftsType}</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''"> and trl.risk_list_crafts_description = #{riskListCraftsDescription}</if>
            <if test="regionId != null  and regionId != ''"> and trl.region_id = #{regionId}</if>
            <if test="deptId != null "> and trl.dept_id = #{deptId}</if>
            <if test="userId != null "> and trl.user_id = #{userId}</if>
            <if test="riskType != null "> and trl.risk_type = #{riskType}</if>
            <if test="companyId != null "> and trl.company_id = #{companyId}</if>
            <if test="isEvaluation != null and isEvaluation == 0"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) = 0</if>
            <if test="isEvaluation != null and isEvaluation == 1"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) > 0</if>
 
            <if test="regionName != null  and regionName != ''"> and tr.region_name like concat('%', #{regionName}, '%')</if>
            <if test="deptName != null  and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
        </where>
    </select>
 
    <select id="selectRiskListByDevice" parameterType="RiskList" resultMap="DeviceResult">
        <include refid="selectRiskListVo"/>
        <where>
            <if test="riskListId != null "> and trl.risk_list_id = #{riskListId}</if>
            <if test="createBy != null  and createBy != ''"> and trl.create_by like concat('%', #{createBy}, '%')</if>
            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
                and trl.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
            </if>
            <if test="riskListNum != null  and riskListNum != ''"> and trl.risk_list_num = #{riskListNum}</if>
            <if test="riskListName != null  and riskListName != ''"> and trl.risk_list_name like concat('%', #{riskListName}, '%')</if>
            <if test="riskListIsSpecial != null "> and trl.risk_list_is_special = #{riskListIsSpecial}</if>
            <if test="riskListImgUrl != null  and riskListImgUrl != ''"> and trl.risk_list_img_url = #{riskListImgUrl}</if>
            <if test="riskListDeviceType != null "> and trl.risk_list_device_type = #{riskListDeviceType}</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''"> and trl.risk_list_device_model = #{riskListDeviceModel}</if>
            <if test="riskListWorkType != null "> and trl.risk_list_work_type = #{riskListWorkType}</if>
            <if test="riskListWorkFrequency != null "> and trl.risk_list_work_frequency = #{riskListWorkFrequency}</if>
            <if test="riskListCraftsType != null "> and trl.risk_list_crafts_type = #{riskListCraftsType}</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''"> and trl.risk_list_crafts_description = #{riskListCraftsDescription}</if>
            <if test="regionId != null  and regionId != ''"> and trl.region_id = #{regionId}</if>
            <if test="deptId != null "> and trl.dept_id = #{deptId}</if>
            <if test="userId != null "> and trl.user_id = #{userId}</if>
            <if test="riskType != null "> and trl.risk_type = #{riskType}</if>
            <if test="companyId != null "> and trl.company_id = #{companyId}</if>
            <if test="isEvaluation != null and isEvaluation == 0"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) = 0</if>
            <if test="isEvaluation != null and isEvaluation == 1"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) > 0</if>
 
            <if test="regionName != null  and regionName != ''"> and tr.region_name like concat('%', #{regionName}, '%')</if>
            <if test="deptName != null  and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
        </where>
    </select>
 
    <select id="selectRiskListByWork" parameterType="RiskList" resultMap="WorkResult">
        <include refid="selectRiskListVo"/>
        <where>
            <if test="riskListId != null "> and trl.risk_list_id = #{riskListId}</if>
            <if test="createBy != null  and createBy != ''"> and trl.create_by like concat('%', #{createBy}, '%')</if>
            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
                and trl.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
            </if>
            <if test="riskListNum != null  and riskListNum != ''"> and trl.risk_list_num = #{riskListNum}</if>
            <if test="riskListName != null  and riskListName != ''"> and trl.risk_list_name like concat('%', #{riskListName}, '%')</if>
            <if test="riskListIsSpecial != null "> and trl.risk_list_is_special = #{riskListIsSpecial}</if>
            <if test="riskListImgUrl != null  and riskListImgUrl != ''"> and trl.risk_list_img_url = #{riskListImgUrl}</if>
            <if test="riskListDeviceType != null "> and trl.risk_list_device_type = #{riskListDeviceType}</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''"> and trl.risk_list_device_model = #{riskListDeviceModel}</if>
            <if test="riskListWorkType != null "> and trl.risk_list_work_type = #{riskListWorkType}</if>
            <if test="riskListWorkFrequency != null "> and trl.risk_list_work_frequency = #{riskListWorkFrequency}</if>
            <if test="riskListCraftsType != null "> and trl.risk_list_crafts_type = #{riskListCraftsType}</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''"> and trl.risk_list_crafts_description = #{riskListCraftsDescription}</if>
            <if test="regionId != null  and regionId != ''"> and trl.region_id = #{regionId}</if>
            <if test="deptId != null "> and trl.dept_id = #{deptId}</if>
            <if test="userId != null "> and trl.user_id = #{userId}</if>
            <if test="riskType != null "> and trl.risk_type = #{riskType}</if>
            <if test="companyId != null "> and trl.company_id = #{companyId}</if>
            <if test="isEvaluation != null and isEvaluation == 0"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) = 0</if>
            <if test="isEvaluation != null and isEvaluation == 1"> and (SELECT COUNT(1) FROM tr_risk_evaluation_plan AS p WHERE trl.`risk_list_id` = p.evaluation_risk_id AND p.stage_status = 4 ) > 0</if>
 
            <if test="regionName != null  and regionName != ''"> and tr.region_name like concat('%', #{regionName}, '%')</if>
            <if test="deptName != null  and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
        </where>
    </select>
    
    <select id="selectRiskListById" parameterType="Long" resultMap="RiskListResult">
        <include refid="selectRiskListVo"/>
        where risk_list_id = #{riskListId}
    </select>
 
    <insert id="insertRiskList" parameterType="RiskList" useGeneratedKeys="true" keyProperty="riskListId">
        insert into tr_risk_list
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="remark != null  and remark != ''">remark,</if>
            <if test="riskListNum != null  and riskListNum != ''">risk_list_num,</if>
            <if test="riskListName != null  and riskListName != ''">risk_list_name,</if>
            <if test="riskListIsSpecial != null ">risk_list_is_special,</if>
            <if test="riskListImgUrl != null  and riskListImgUrl != ''">risk_list_img_url,</if>
            <if test="riskListDeviceType != null ">risk_list_device_type,</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''">risk_list_device_model,</if>
            <if test="riskListWorkType != null ">risk_list_work_type,</if>
            <if test="riskListWorkFrequency != null ">risk_list_work_frequency,</if>
            <if test="riskListCraftsType != null ">risk_list_crafts_type,</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''">risk_list_crafts_description,</if>
            <if test="regionId != null  and regionId != ''">region_id,</if>
            <if test="deptId != null ">dept_id,</if>
            <if test="userId != null ">user_id,</if>
            <if test="riskType != null ">risk_type,</if>
            <if test="companyId != null ">company_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
            <if test="riskListNum != null  and riskListNum != ''">#{riskListNum},</if>
            <if test="riskListName != null  and riskListName != ''">#{riskListName},</if>
            <if test="riskListIsSpecial != null ">#{riskListIsSpecial},</if>
            <if test="riskListImgUrl != null  and riskListImgUrl != ''">#{riskListImgUrl},</if>
            <if test="riskListDeviceType != null ">#{riskListDeviceType},</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''">#{riskListDeviceModel},</if>
            <if test="riskListWorkType != null ">#{riskListWorkType},</if>
            <if test="riskListWorkFrequency != null ">#{riskListWorkFrequency},</if>
            <if test="riskListCraftsType != null ">#{riskListCraftsType},</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''">#{riskListCraftsDescription},</if>
            <if test="regionId != null  and regionId != ''">#{regionId},</if>
            <if test="deptId != null ">#{deptId},</if>
            <if test="userId != null ">#{userId},</if>
            <if test="riskType != null ">#{riskType},</if>
            <if test="companyId != null ">#{companyId},</if>
         </trim>
    </insert>
 
    <update id="updateRiskList" parameterType="RiskList">
        update tr_risk_list
        <trim prefix="SET" suffixOverrides=",">
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="riskListNum != null  and riskListNum != ''">risk_list_num = #{riskListNum},</if>
            <if test="riskListName != null  and riskListName != ''">risk_list_name = #{riskListName},</if>
            <if test="riskListIsSpecial != null">risk_list_is_special = #{riskListIsSpecial},</if>
            <if test="riskListImgUrl != null">risk_list_img_url = #{riskListImgUrl},</if>
            <if test="riskListDeviceType != null ">risk_list_device_type = #{riskListDeviceType},</if>
            <if test="riskListDeviceModel != null  and riskListDeviceModel != ''">risk_list_device_model = #{riskListDeviceModel},</if>
            <if test="riskListWorkType != null ">risk_list_work_type = #{riskListWorkType},</if>
            <if test="riskListWorkFrequency != null ">risk_list_work_frequency = #{riskListWorkFrequency},</if>
            <if test="riskListCraftsType != null ">risk_list_crafts_type = #{riskListCraftsType},</if>
            <if test="riskListCraftsDescription != null  and riskListCraftsDescription != ''">risk_list_crafts_description = #{riskListCraftsDescription},</if>
            <if test="regionId != null  and regionId != ''">region_id = #{regionId},</if>
            <if test="deptId != null ">dept_id = #{deptId},</if>
            <if test="userId != null ">user_id = #{userId},</if>
            <if test="riskType != null ">risk_type = #{riskType},</if>
            <if test="companyId != null ">company_id = #{companyId},</if>
        </trim>
        where risk_list_id = #{riskListId}
    </update>
 
    <delete id="deleteRiskListById" parameterType="Long">
        delete from tr_risk_list where risk_list_id = #{riskListId}
    </delete>
 
    <delete id="deleteRiskListByIds" parameterType="String">
        delete from tr_risk_list where risk_list_id in 
        <foreach item="riskListId" collection="array" open="(" separator="," close=")">
            #{riskListId}
        </foreach>
    </delete>
 
 
<!--    RiskList getInfoByRiskId(String riskId);-->
    <select id="getInfoByRiskId"  parameterType="RiskList" resultMap="RiskListResult">
        select * from tr_risk_list where risk_list_id = #{riskId}
    </select>
 
<!--    RiskList getInfoByRiskListId(Long riskUnitId);-->
    <select id="getInfoByRiskListId" parameterType="RiskList" resultMap="RiskListResult">
        select * from tr_risk_list where risk_list_id = #{riskUnitId} and user_id is not null
    </select>
 
<!--    List<RiskList> getRiskUnitLists();    -->
    <select id="getRiskUnitLists" parameterType="RiskList" resultMap="RiskListResult">
    select * from tr_risk_list
</select>
 
<!--    RiskList getInfoByRiskListName(String riskListName);-->
    <select id="getInfoByRiskListName" parameterType="RiskList" resultMap="RiskListResult">
        select * from tr_risk_list
        where risk_list_name = #{riskListName}
    </select>
 
 
    <resultMap type="com.ruoyi.project.tr.riskList.domain.RiskList" id="RiskListResultOfPlan">
        <result property="riskListId"    column="risk_list_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="riskListNum"    column="risk_list_num"    />
        <result property="riskListName"    column="risk_list_name"    />
        <result property="riskListIsSpecial"    column="risk_list_is_special"    />
        <result property="riskListImgUrl"    column="risk_list_img_url"    />
        <result property="riskListDeviceType"    column="risk_list_device_type"    />
        <result property="riskListDeviceModel"    column="risk_list_device_model"    />
        <result property="riskListWorkType"    column="risk_list_work_type"    />
        <result property="riskListWorkFrequency"    column="risk_list_work_frequency"    />
        <result property="riskListCraftsType"    column="risk_list_crafts_type"    />
        <result property="riskListCraftsDescription"    column="risk_list_crafts_description"    />
        <result property="regionId"    column="region_id"    />
        <result property="regionName"    column="region_name"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="riskTypeName"    column="risk_type_name"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="riskType"    column="risk_type"    />
        <result property="companyId"    column="company_id"    />
        <result property="isEvaluation"    column="is_evaluation"    />
 
        <result property="evaluationNowFengxianJibie"    column="evaluation_now_fengxian_jibie"    />
        <result property="evaluationNowFengxianse"    column="evaluation_now_fengxianse"    />
        <result property="evaluationNowJibie"    column="evaluation_now_jibie"    />
    </resultMap>
<!--    List<RiskList> getAllPlan(int riskType);-->
    <select id="getAllPlan"  resultMap="RiskListResultOfPlan">
        SELECT
            a.*,
            c.evaluation_now_fengxian_jibie,
            c.evaluation_now_fengxianse,
            c.evaluation_now_jibie
        FROM tr_risk_list a
        LEFT JOIN tr_risk_evaluation_plan b ON b.evaluation_risk_id = a.risk_list_id
        left join tr_risk_check_point c on c.plan_id = b.plan_id
        where a.risk_type = 5
    </select>
 
<!--    ResultVO<List<RiskList>> listHazardSource();-->
    <select id="listHazardSource"  resultMap="RiskListResult">
        SELECT * FROM tr_risk_list
        where risk_list_num is not null
    </select>
<!--    RiskList getInfoByRiskListNum(String hazardCode);-->
    <select id="getInfoByRiskListNum"  resultMap="RiskListResult">
        SELECT * FROM tr_risk_list
        where risk_list_num = #{hazardCode}
    </select>
</mapper>