jinlin
2024-11-19 195bb5267a6ece13363303e177fee7d1fa3941aa
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
<?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.SimulatAssessDao">
 
    <select id="getList" resultType="com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess">
        select id, CONCAT_WS(' ', name, CREATE_DATE) AS name
        from simulat_assess
        where task_model_id = ${taskModelId}
          and IS_DELETE = 0
        order by CREATE_DATE desc
    </select>
    <select id="getNumById" resultType="java.lang.Integer">
        select COUNT(*)
        from simulat_assess
        where product_id = ${productId}
          and task_model_id = ${taskModelId}
          and IS_DELETE = 0
    </select>
    <select id="getParams" resultType="com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess">
        select a.sampl_period, a.simulat_frequency
        from simulat_assess a
        where a.id = ${id}
          and a.task_model_id = ${taskModelId}
          and a.IS_DELETE = 0
    </select>
    <select id="getChildren" resultType="com.zt.life.modules.mainPart.taskReliability.dto.ProductStatusDto">
        select *
        from (
                 SELECT f.id, f.name, 0 as sort, 1 as sameSbNum,f.product_type
                 FROM product_model f
                 WHERE f.id = ${productId}
                   AND f.is_delete = 0
                 union
                 SELECT f.id, f.name, f.sort, g.basic_unit_num as sameSbNum,f.product_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 d.product_id = ${productId}
                   AND a.is_delete = 0
                   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 g.product_id = f.id
                   AND g.is_delete = 0
                 GROUP BY f.id, f.name, f.sort
             ) as f
        ORDER BY f.sort
    </select>
    <select id="getTaskPhaseModelByTaskId"
            resultType="com.zt.life.modules.mainPart.taskReliability.model.SimulatAssessTaskPhaseModel">
        select *
        from simulat_assess_task_phase_model
        where is_delete = 0
          and task_id = ${taskId}
        order by sort
    </select>
    <select id="getTimeDiagram" resultType="com.zt.life.modules.mainPart.taskReliability.model.TimeDiagram">
        select *
        from time_diagram_temp
        where is_delete = 0
        <if test="projectId!=null and projectId!=''">
            and PROJECT_ID = #{projectId}
        </if>
        <if test="diagramId!=null and diagramId!=''">
            and DIAGRAM_ID = #{diagramId}
        </if>
        <if test="hasPublish!=null and hasPublish!=''">
            and HAS_PUBLISH = #{hasPublish}
        </if>
    </select>
    <select id="getModelListOld" resultType="com.zt.life.modules.mainPart.taskReliability.dto.ModelDto">
        SELECT a.id   AS phase_id,
               a.phase_name,
               a.phase_duration_rate,
               b.operat_condit_duration_rate,
               b.operat_condit_id,
               c.NAME AS operat_condit_name,
               d.model_id,
               e.model_name
        FROM `task_phase` a,
             task_phase_model b,
             operat_condit c,
             operat_condit_model d,
             model_rbd e
        WHERE a.task_id = ${taskId}
          and d.product_id = ${productId}
          AND a.is_delete = 0
          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.is_delete = 0
          and d.model_id = e.id
        order by c.CREATE_DATE
    </select>
    <select id="getModelList"
            resultType="com.zt.life.modules.mainPart.taskReliability.model.SimulatAssessTaskPhaseModel">
        SELECT *
        FROM simulat_assess_task_phase_model
        WHERE fz_id = ${fzId}
          AND is_delete = 0
        order by sort
    </select>
    <select id="getModelByProductGk" resultType="com.zt.life.modules.mainPart.taskReliability.model.ModelRbd">
        select a.*
        from model_rbd a,
             operat_condit_model b
        where a.id = b.model_id
          and b.operat_condit_id = ${gkId}
          and b.product_id = ${productId}
          and a.is_delete = 0
          and b.is_delete = 0
        limit 1
    </select>
    <select id="getProductList" resultType="com.zt.life.modules.mainPart.taskReliability.dto.WeakDto">
        SELECT id,
               pid,
               NAME,
               product_type,
               sum(timeRate) AS timeRate,
               sort
        FROM (
                 SELECT f.id,
                        null as pid,
                        f.NAME,
                        f.product_type,
                        1    AS timeRate,
                        0    AS sort
                 FROM product_model f
                 WHERE f.id = ${productId}
                   AND f.is_delete = 0
                 UNION
                 SELECT f.id,
                        f.pid,
                        f.NAME,
                        f.product_type,
                        CASE
 
                            WHEN f.product_type = 5
                                AND g.reliab_distrib_type = 1 THEN
                                    a.phase_duration_rate * b.operat_condit_duration_rate * g.task_mtbcf_operating_ratio
                            ELSE a.phase_duration_rate * b.operat_condit_duration_rate
                            END AS timeRate,
                        f.sort
                 FROM `task_phase` a,
                      task_phase_model b,
                      operat_condit c,
                      operat_condit_model d,
                      model_rbd_node e,
                      product_model f
                          left join param_data g on g.product_id = f.id
                          AND g.IS_DELETE = 0
                 WHERE a.task_id = ${taskId}
                   AND b.phase_id = a.id
                   AND b.is_delete = 0
                   AND a.is_delete = 0
                   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.ship_id = ${productId}
                   AND f.is_delete = 0
             ) b
        GROUP BY id
        order by sort
    </select>
    <select id="getByTaskId" resultType="com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess">
        select *
        from simulat_assess
        where task_model_id = ${taskModelId}
          and IS_DELETE = 0
        order by CREATE_DATE desc
        limit 1
    </select>
    <select id="getModel" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel">
        SELECT d.product_id,
               d.model_id,
               e.content
        FROM task a,
             task_phase b,
             `task_phase_model` c,
             operat_condit_model d,
             model_rbd e
        WHERE a.id = ${taskId}
          AND a.IS_DELETE = 0
          AND b.task_id = a.id
          AND b.IS_DELETE = 0
          AND c.phase_id = b.id
          AND c.operat_condit_duration_rate > 0
          AND c.IS_DELETE = 0
          AND d.operat_condit_id = c.operat_condit_id
          AND d.IS_DELETE = 0
          AND e.id = d.model_id
          AND e.IS_DELETE = 0
    </select>
    <select id="getNode" resultType="com.zt.life.modules.mainPart.taskReliability.dto.verifyDto">
        SELECT c.`NAME`,
               c.id,
               b.task_mtbcf_regulate as mtbf
        FROM `model_rbd_node` a,
             param_data b,
             product_model c
        WHERE a.node_id = c.id
          and a.model_id = ${modelId}
          AND c.id = b.product_id
          AND a.is_delete = 0
          AND b.is_delete = 0
          AND c.is_delete = 0
    </select>
    <select id="getVoteNum" resultType="java.lang.Integer">
        select vote_num
        from algorithm
        where is_delete = 0
          and model_id = ${modelId}
          and model_type = 'vote'
          and vote_num is not null
        limit 1
    </select>
 
    <select id="getProcessList" resultType="com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess">
        select *
        from simulat_assess
        where IS_DELETE = 0
          and pid is not null
        <if test="isAlive">
          and process_is_alive=1
        </if>
        order by process_start_time desc
    </select>
</mapper>