xyc
2025-02-21 664db98c9e8595ce4dd636a27f480e3a08b81ff5
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
<?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.zt.life.modules.mainPart.taskReliability.dao.TaskRepairParamDao">
 
    <select id="getList" resultType="com.zt.life.modules.mainPart.taskReliability.model.TaskRepairParam">
        select d.*,
               case
                   when e.status is null then 0
                   else e.status end as status,
               e.id
        from (
                 select task_id, phase_id, phase_name, phase_sort, equip_type
                 from (
                          SELECT a.task_id
                               , a.id as phase_id
                               , a.phase_name
                               , a.phase_sort
                               , f.equip_type
                          FROM `task_phase` a
                             , task_phase_model b
                             , operat_condit c
                             , operat_condit_model d
                             , model_rbd_node e
                             , product_model f
                             , param_data g
                          where a.task_id = ${taskId}
                            and a.is_delete = 0
                            and b.phase_id = a.id
                            and b.is_delete = 0
                            and c.id = b.operat_condit_id
                            and c.is_delete = 0
                            and d.operat_condit_id = c.id
                            and d.is_delete = 0
                            and e.model_id = d.model_id
                            and e.is_delete = 0
                            and f.id = e.node_id
                            and f.is_delete = 0
                            and f.equip_type is not null
                            and g.product_id = f.id
                            and g.is_delete = 0
                            and g.repairable = 1
                      ) c
                 group by task_id, phase_id, phase_name, phase_sort, equip_type
             ) d
                 left join task_repair_param e
                           on e.task_id = d.task_id and e.phase_id = d.phase_id and e.equip_type = d.equip_type
    </select>
 
    <select id="getTaskRepairConstraints" resultType="com.zt.life.modules.mainPart.taskReliability.dto.TaskPhaseConstraintDto">
        SELECT
            h.task_id,
            h.phase_id,
            b.operat_condit_id as gk_model_id,
            d.model_id,
            h.equip_type,
            h.STATUS,
            f.`NAME` as product_name,
            f.ID as product_id
        FROM
            task_phase a,
            task_phase_model b,
            operat_condit c,
            operat_condit_model d,
            model_node_algorithm e,
            product_model f,
            param_data g,
            task_repair_param h
        WHERE
            a.task_id = #{taskId}
          AND a.is_delete = 0
          AND b.phase_id = a.id
          and a.id = #{phaseId}
          AND b.is_delete = 0
          AND c.id = b.operat_condit_id
          and c.id = #{gkId}
          AND c.is_delete = 0
          AND d.operat_condit_id = c.id
          AND d.is_delete = 0
          AND d.is_disabled = 0
          AND e.model_id = d.model_id
          AND e.is_delete = 0
          AND f.id = e.data_id
          AND f.is_delete = 0
          AND g.product_id = f.id
          AND g.is_delete = 0
          AND g.repairable = 1
          and h.task_id = a.task_id
          and h.phase_id = b.phase_id
          and h.`STATUS` = 1
          and h.equip_type = f.equip_type
        order by h.task_id,
                 h.phase_id,
                 b.operat_condit_id,
                 d.model_id,
                 h.equip_type,
                 f.`NAME`
    </select>
</mapper>