Houjie
2025-06-10 be8a6f171bd41aa50fb7310b2ccbe753dac20b89
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
<?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="org.jeecg.modules.eam.mapper.PredictiveWorkPlanWarnMapper">
 
    <select id="listPredictiveWorkPlanWarn" parameterType="Map"
            resultType="org.jeecg.modules.eam.entity.PredictiveWorkPlanWarn">
        SELECT MAX(t1.AlarmNo) warnCode,
        MAX (t1.AlarmContent) warnName,
        max(t1.EquipmentID) mdcEquipmentId
        FROM
        EquipmentAlarm t1
        LEFT JOIN Equipment t2 ON t2.EquipmentID = t1.EquipmentID
        LEFT JOIN mom_eam_equipment t3 ON t3.num = t2.EquipmentID
        WHERE t3.id = #{params.equipmentId} AND t1.AlarmNo <![CDATA[ <> ]]>  ''
        <if test="params.warnCode != null and params.warnCode != ''">
            and t1.AlarmNo = concat('%',#{params.warnCode},'%')
        </if>
        <if test="params.warnName != null and params.warnName != ''">
            and t1.AlarmContent = concat('%',#{params.warnName},'%')
        </if>
        GROUP BY t1.AlarmNo, t1.AlarmContent, t1.EquipmentID
    </select>
 
    <select id="pagePredictiveWorkPlanWarn" parameterType="Map" resultType="Map">
        SELECT
        t1.id,
        t1.work_plan_id workPlanId,
        t1.parameter_condition parameterCondition,
        t1.warn_id warnId,
        t1.warn_code warnCode,
        t1.warn_name warnName,
        t1.warn_cycle warnCycle,
        t1.cycle_unit cycleUnit,
        t1.times,
        t2.item_text conditionalRelationName,
        t3.item_text cycleUnitName
        FROM
        mom_eam_predictive_work_plan_warn t1
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'conditional_relation' ) t2 ON t2.item_value =
        t1.parameter_condition
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'warn_cycle_unit' ) t3 ON t3.item_value = t1.cycle_unit
        WHERE
        t1.del_flag = 0
        <if test="params.planId != null and params.planId != ''">
            and t1.work_plan_id = #{params.planId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="listWarn" resultType="org.jeecg.modules.eam.entity.PredictiveWorkPlanWarn">
        SELECT
        t1.id,
        t1.work_plan_id workPlanId,
        t1.parameter_condition parameterCondition,
        t1.warn_id warnId,
        t1.warn_code warnCode,
        t1.warn_name warnName,
        t1.warn_cycle warnCycle,
        t1.cycle_unit cycleUnit,
        t1.times,
        t1.mdc_equipment_id mdcEquipmentId
        FROM
        mom_eam_predictive_work_plan_warn t1
        WHERE
        t1.del_flag = 0 and t1.work_plan_id = #{predictiveWorkPlanId}
        ORDER BY t1.create_time desc
    </select>
 
    <select id="findWarnInfo" resultType="org.jeecg.modules.eam.model.MdcEquipmentAlarmVo">
        SELECT TOP ${times}
            t1.EquipmentID equipmentId,
            t1.collectTime,
            t1.AlarmNo,
            t1.AlarmContent
        FROM
            EquipmentAlarm t1
        WHERE
            t1.EquipmentID = #{mdcEquipmentId}
            AND t1.AlarmNo = #{warnCode}
        ORDER BY
            t1.collectTime DESC
    </select>
 
</mapper>