liujie
2026-01-23 f87760efbc6b10685540a003e1d4ae7e4d9d00fa
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
<?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.system.mapper.RecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.Record">
        <id column="id" property="id" />
        <result column="record_type" property="recordType" />
        <result column="create_time" property="createTime" />
        <result column="deleted" property="deleted" />
        <result column="name" property="name" />
        <result column="update_time" property="updateTime" />
        <result column="hierarchy_name" property="hierarchyName" />
        <result column="hierarchy_names" property="hierarchyNames" />
        <result column="remark" property="remark" />
        <result column="level" property="level" />
        <result column="number_factor_index" property="numberFactorIndex" />
        <result column="problem_part" property="problemPart" />
        <result column="reformed" property="reformed" />
        <result column="scale_factor_index" property="scaleFactorIndex" />
        <result column="specific_term_indexes" property="specificTermIndexes" />
        <result column="suggestion" property="suggestion" />
        <result column="hierarchy_path" property="hierarchyPath" />
        <result column="content" property="content" />
        <result column="creator_id" property="creatorId" />
        <result column="check_task_id" property="checkTaskId" />
        <result column="device_id" property="deviceId" />
        <result column="problem_id" property="problemId" />
        <result column="error_review_id" property="errorReviewId" />
        <result column="responsible_person" property="responsiblePerson" />
    </resultMap>
    <select id="getHiddenDangerList" resultType="com.ruoyi.system.vo.HiddenDangerListVo">
 
        select * from (
        select t1.id,t1.hierarchy_name,t2.description,t1.problem_part problemPart,t1.remark,t1.level,t4.name planName,t1.problem_id problemId,
        case
        when t1.device_id is null then 1
        else 2
        end as type,
        t1.create_time,t1.reformed,t1.responsible_person responsiblePerson
        from record t1
        left join problem t2 on t1.problem_id = t2.id
        left join task t3 on t1.check_task_id = t3.id
        left join plan t4 on t3.plan_id = t4.id
        where t1.deleted = 0 and t1.level is not null
        and t1.check_task_id in
        <foreach item="item" index="index" collection="taskIds" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="query.reformed != null">
            and t1.reformed = #{query.reformed}
        </if>
        <if test="query.type == null">
            and t1.level = 0
        </if>
        <if test="query.content != null">
            and t1.hierarchy_name like concat('%',#{query.content},'%')
        </if>
        <if test="query.startTime != null and query.startTime !='' and query.endTime!=null and query.endTime !=''">
            and t1.create_time between #{query.startTime} and #{query.endTime}
        </if>
 
        ) as o where 1=1
        <if test="query.type != null">
            and o.type = #{query.type}
        </if>
        order by o.create_time desc
    </select>
 
    <select id="getHiddenDangerDetail" resultType="com.ruoyi.system.vo.ProblemVo">
        select specific_terms specificTermsStr,suggest_actions suggestActionsStr,number_factors numberFactorsStr
        from problem
        where id = #{problemId}
    </select>
    <select id="getErrorReview" resultType="com.ruoyi.system.model.ErrorReview">
        select t1.id, t1.create_time,
            t1.deleted,
            t1.name,
            t1.update_time,
            t1.content,
            t1.state,
            t1.creator_id, t2.name creator
        from error_review t1
                 left join user t2 on t1.creator_id = t2.id
        where t1.id = #{errorReviewId}
 
    </select>
    <select id="findReviewImg" resultType="java.lang.String">
        select CONCAT(t2.name, '.', t2.extension) from error_review_image t1
                 left join user_file t2 on t1.user_file_id = t2.id
        where t1.error_review_id = #{errorReviewId}
    </select>
    <select id="getProjectName" resultType="java.lang.String">
        select t2.name from task t1 left join project t2 on t1.project_id = t2.id
                    where t1.id = #{checkTaskId}
    </select>
 
</mapper>