qushaowei
2024-07-25 654dc30c50b1c176966ad8e6e7d791b92531de83
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
<?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.DailyMaintenanceOrderMapper">
    <select id="getMaintenanceProjectId"  parameterType="Map" resultType="map">
        SELECT
            t1.id,
            t1.id as  maintenanceStandardDetailId,
            t2.id as  maintenanceStandardId,
            t1.location,
            t1.photo,
            t1.maintenance_project_id as maintenanceProjectId,
            t5.item_text as maintenanceRole,
            t3.num as maintenanceProjectNum,
            t3.name as maintenanceProjectName,
            t3.standard,
            t4.item_text as maintenanceMethod,
            t3.maintenance_tool as maintenanceTool
        FROM
            mom_eam_maintenance_standard_detail t1
        LEFT JOIN mom_eam_maintenance_standard t2 ON t1.maintenance_standard_id = t2.id
        LEFT JOIN mom_eam_maintenance_project t3 ON t1.maintenance_project_id = t3.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t3.maintenance_method
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_role' ) t5 ON t5.item_value = t1.maintenance_role
        where t1.del_flag = '0' and t2.del_flag = '0' and t3.del_flag = '0' and t2.type = 'daily'
        <if test="maintenanceStandardId != null and maintenanceStandardId != ''">
            and t2.id = #{maintenanceStandardId}
        </if>
        <if test="maintenanceCycleId != null and maintenanceCycleId != ''">
            and t1.maintenance_cycle_id = #{maintenanceCycleId}
        </if>
    </select>
 
    <select id="getMaintenanceCycleByStandardId"  parameterType="Map" resultType="org.jeecg.modules.eam.model.MaintenanceCycleVo">
        SELECT DISTINCT
            t2.id AS value,
            t2.name AS text,
            t2.name AS title
        FROM
            mom_eam_maintenance_standard_detail t1
            LEFT JOIN mom_eam_maintenance_cycle t2 ON t1.maintenance_cycle_id = t2.id
        WHERE
            t1.del_flag = 0 and t1.maintenance_standard_id = #{maintenanceStandardId}
    </select>
 
    <select id="getDailyMaintenanceOrderList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.status,
            t5.item_text as statusName,
            t1.num,
            t4.id as maintenanceCycleId,
            t4.maintenance_type as maintenanceType,
            t10.item_text as maintenanceTypeName,
            t4.cycle as maintenanceCycle,
            t4.name as maintenanceCycleName,
            t3.id as equipmentId,
            t3.num as equipmentNum,
            t3.name as equipmentName,
            t3.model as equipmentModel,
            t3.specification,
            t3.technology_status as technologyStatus,
            t3.precision_parameters as precisionParameters,
            t11.id as equipmentCategoryId,
            t11.name as equipmentCategoryName,
            t2.id as maintenanceStandardId,
            t2.num as maintenanceStandardNum,
            t2.assign_mode assignMode,
            t3.team_id teamId,
            t3.use_id as useId,
            t6.depart_name as departName,
            t7.name as teamName,
            DATEADD(DAY,-30,t1.plan_start_time)   as yellowWarningTime,
            DATEADD(DAY,-7,t1.plan_start_time)   as redWarningTime,
            CONVERT(varchar(100), GETDATE(), 20) AS currentDateTime,
            t1.plan_start_time as planStartTime,
            t1.plan_end_time as planEndTime,
            t1.actual_start_time as actualStartTime,
            t1.actual_end_time as actualEndTime,
            t1.maintenance_date as maintenanceDate,
            t9.item_text as assignModeName,
            t1.create_by as createBy,
            t1.create_time as createTime,
            t1.remark,
            t1.description,
            t1.confirm_status as confirmStatus,
            t1.precision_inspection_status as precisionInspectionStatus,
            t1.maintenance_order_uda3 as receipts,
            t12.num as receiptsNum,
            t13.item_text as receiptsName,
            t14.item_text as confirmStatusName
        FROM
            mom_eam_daily_maintenance_order t1
        LEFT JOIN mom_eam_maintenance_standard t2 ON t1.maintenance_standard_id = t2.id
        left join mom_eam_equipment t3 on t1.equipment_id = t3.id
        left join mom_eam_equipment_category t11 on t3.equipment_category_id = t11.id
        left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'daily_maintenance_order_status' ) t5 on t5.item_value = t1.status
        left join sys_depart t6 on t3.use_id = t6.id
        left join mom_base_team t7 on t7.id = t3.team_id
        left join ( SELECT * FROM v_sys_dict WHERE dict_code = 'assign_mode' ) t9 on t9.item_value = t2.assign_mode
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_type') t10 on t10.item_value = t4.maintenance_type
        left join sys_file_name t12 on t1.maintenance_order_uda3 = t12.id
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'sys_file_name') t13 on t13.item_value = t12.name
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'two_maintenance_devolution_status') t14 on t14.item_value = t1.confirm_status
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t3.del_flag = 0 and t4.del_flag = 0 and t4.maintenance_type =#{params.maintenanceType}
        <if test="params.num != null and params.num != ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.equipmentNum != null and params.equipmentNum != ''">
            and t3.num like concat('%',#{params.equipmentNum},'%')
        </if>
        <if test="params.useDepartId != null and params.useDepartId != ''">
            and t3.use_id = #{params.useDepartId}
        </if>
        <if test="params.status != null and params.status != ''">
            and t1.status = #{params.status}
        </if>
        <if test="params.confirmStatus != null and params.confirmStatus != ''">
            and t1.confirm_status  = #{params.confirmStatus}
        </if>
        <if test="params.teamId != null and params.teamId != ''">
            and t3.team_id = #{params.teamId}
        </if>
        <if test="params.finishStartTime != null">
            and t1.actual_end_time &gt;= #{params.finishStartTime}
        </if>
        <if test="params.finishEndTime != null">
            and t1.actual_end_time &lt;= #{params.finishEndTime}
        </if>
        <if test="params.workCenterIds != null">
            and t3.work_center_id in
            <foreach collection="params.workCenterIds" open="(" separator="," close=")" item="workCenterId">
                #{workCenterId}
            </foreach>
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getDailyMaintenanceOrder3List"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.status,
            t5.item_text as statusName,
            t1.num,
            t1.num as technologyStatusVerificationBill,
            t4.id as maintenanceCycleId,
            t4.maintenance_type as maintenanceType,
            t10.item_text as maintenanceTypeName,
            t4.cycle as maintenanceCycle,
            t4.name as maintenanceCycleName,
            t3.id as equipmentId,
            t3.num as equipmentNum,
            t3.name as equipmentName,
            t3.model as equipmentModel,
            t3.specification,
            t3.technology_status as technologyStatus,
            t3.precision_parameters as precisionParameters,
            t11.id as equipmentCategoryId,
            t11.name as equipmentCategoryName,
            t2.id as maintenanceStandardId,
            t2.num as maintenanceStandardNum,
            t2.assign_mode assignMode,
            t3.team_id teamId,
            t3.use_id as useId,
            t6.depart_name as departName,
            t7.name as teamName,
            DATEADD(DAY,-30,t1.plan_start_time)   as yellowWarningTime,
            DATEADD(DAY,-7,t1.plan_start_time)   as redWarningTime,
            CONVERT(varchar(100), GETDATE(), 20) AS currentDateTime,
            t1.plan_start_time as planStartTime,
            t1.plan_end_time as planEndTime,
            t1.actual_start_time as actualStartTime,
            t1.actual_end_time as actualEndTime,
            t9.item_text as assignModeName,
            t1.create_by as createBy,
            t1.create_time as createTime,
            t1.remark,
            t1.description,
            t1.precision_inspection_status as precisionInspectionStatus,
            t1.stove_exempt_status as stoveExemptStatus,
            t1.inspect_user as inspectUser,
            t1.inspect_date as inspectDate,
            t12.item_text as checkStatusName,
            t1.not_pass_reason as notPassReason,
            t1.maintenance_order_uda5 as receipts,
            t13.num as receiptsNum,
            t14.item_text as receiptsName,
            t1.maintenance_order_uda4 as receipts2,
            t15.num as receiptsNum2,
            t16.item_text as receiptsName2
        FROM
            mom_eam_daily_maintenance_order t1
        LEFT JOIN mom_eam_maintenance_standard t2 ON t1.maintenance_standard_id = t2.id
        left join mom_eam_equipment t3 on t1.equipment_id = t3.id
        left join mom_eam_equipment_category t11 on t3.equipment_category_id = t11.id
        left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'daily_maintenance_order_status' ) t5 on t5.item_value = t1.status
        left join sys_depart t6 on t3.use_id = t6.id
        left join mom_base_team t7 on t7.id = t3.team_id
        left join ( SELECT * FROM v_sys_dict WHERE dict_code = 'assign_mode' ) t9 on t9.item_value = t2.assign_mode
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_type') t10 on t10.item_value = t4.maintenance_type
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'check_status') t12 on t12.item_value = t1.check_status
        left join sys_file_name t13 on t1.maintenance_order_uda5 = t13.id
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'sys_file_name') t14 on t14.item_value = t13.name
        left join sys_file_name t15 on t1.maintenance_order_uda4 = t15.id
        left join (SELECT * FROM v_sys_dict WHERE dict_code = 'sys_file_name') t16 on t16.item_value = t15.name
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t3.del_flag = 0 and t4.del_flag = 0 and t4.maintenance_type =#{params.maintenanceType}
        <if test="params.num != null and params.num != ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.equipmentNum != null and params.equipmentNum != ''">
            and t3.num like concat('%',#{params.equipmentNum},'%')
        </if>
        <if test="params.useDepartId != null and params.useDepartId != ''">
            and t3.use_id = #{params.useDepartId}
        </if>
        <if test="params.status != null and params.status != ''">
            and t1.status = #{params.status}
        </if>
        <if test="params.teamId != null and params.teamId != ''">
            and t3.team_id = #{params.teamId}
        </if>
        <if test="params.finishStartTime != null">
            and t1.actual_end_time &gt;= #{params.finishStartTime}
        </if>
        <if test="params.finishEndTime != null">
            and t1.actual_end_time &lt;= #{params.finishEndTime}
        </if>
        <if test="params.workCenterIds != null">
            and t3.work_center_id in
            <foreach collection="params.workCenterIds" open="(" separator="," close=")" item="workCenterId">
                #{workCenterId}
            </foreach>
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getDailyMaintenanceOrderDetailByOrderId"  parameterType="Map" resultType="map">
        SELECT
            tt.id,
            t1.id AS maintenanceStandardDetailId,
            t2.id AS maintenanceStandardId,
            t1.location,
            t1.photo,
            t1.maintenance_project_id AS maintenanceProjectId,
            case t1.maintenance_role when 'operator' then '操作人员保养内容' else '维修人员保养内容' end as maintenanceRole,
            t3.num AS maintenanceProjectNum,
            t3.name as maintenanceProjectName,
            t3.standard,
            t4.item_text AS maintenanceMethod,
            t3.maintenance_tool AS maintenanceTool,
            t3.working_hour_quota AS workingHourQuota,
            tt.maintenance_order_detail_uda1 as maintenanceOrderDetailUda1,
            tt.maintenance_order_detail_uda2 as maintenanceOrderDetailUda2
        FROM
            mom_eam_daily_maintenance_order_detail tt
                LEFT JOIN mom_eam_maintenance_standard_detail t1 ON tt.maintenance_standard_detail_id = t1.id
                LEFT JOIN mom_eam_maintenance_standard t2 ON tt.maintenance_standard_id = t2.id
                LEFT JOIN mom_eam_maintenance_project t3 ON tt.maintenance_project_id = t3.id
                LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t3.maintenance_method
        WHERE t1.del_flag = '0' AND t2.del_flag = '0' AND t3.del_flag = '0' AND t2.type = 'daily'
        <if test="dailyMaintenanceOrderId != null and dailyMaintenanceOrderId != ''">
            and tt.daily_maintenance_order_id = #{dailyMaintenanceOrderId}
        </if>
    </select>
 
    <select id="getRepairUser"  parameterType="Map" resultType="map">
        SELECT
            tt.id,
            t1.id AS maintenanceStandardDetailId,
            t2.id AS maintenanceStandardId,
            t1.location,
            t1.photo,
            t1.maintenance_project_id AS maintenanceProjectId,
            case t1.maintenance_role when 'operator' then '操作人员保养内容' else '维修人员保养内容' end as maintenanceRole,
            t3.num AS maintenanceProjectNum,
            t3.name as maintenanceProjectName,
            t3.standard,
            t4.item_text AS maintenanceMethod,
            t3.maintenance_tool AS maintenanceTool,
            t3.working_hour_quota AS workingHourQuota,
            tt.maintenance_order_detail_uda1 as maintenanceOrderDetailUda1,
            tt.maintenance_order_detail_uda2 as maintenanceOrderDetailUda2
        FROM
            mom_eam_daily_maintenance_order_detail tt
        LEFT JOIN mom_eam_maintenance_standard_detail t1 ON tt.maintenance_standard_detail_id = t1.id
        LEFT JOIN mom_eam_maintenance_standard t2 ON tt.maintenance_standard_id = t2.id
        LEFT JOIN mom_eam_maintenance_project t3 ON tt.maintenance_project_id = t3.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t3.maintenance_method
        WHERE t1.del_flag = '0' AND t2.del_flag = '0' AND t3.del_flag = '0' AND t2.type = 'daily' and t1.maintenance_role = 'maintenance'
        <if test="dailyMaintenanceOrderId != null and dailyMaintenanceOrderId != ''">
            and tt.daily_maintenance_order_id = #{dailyMaintenanceOrderId}
        </if>
    </select>
 
    <select id="getOperationUser"  parameterType="Map" resultType="map">
        SELECT
            tt.id,
            t1.id AS maintenanceStandardDetailId,
            t2.id AS maintenanceStandardId,
            t1.location,
            t1.photo,
            t1.maintenance_project_id AS maintenanceProjectId,
            case t1.maintenance_role when 'operator' then '操作人员保养内容' else '维修人员保养内容' end as maintenanceRole,
            t3.num AS maintenanceProjectNum,
            t3.name as maintenanceProjectName,
            t3.standard,
            t4.item_text AS maintenanceMethod,
            t3.maintenance_tool AS maintenanceTool,
            t3.working_hour_quota AS workingHourQuota,
            tt.maintenance_order_detail_uda1 as maintenanceOrderDetailUda1,
            tt.maintenance_order_detail_uda2 as maintenanceOrderDetailUda2
        FROM
            mom_eam_daily_maintenance_order_detail tt
        LEFT JOIN mom_eam_maintenance_standard_detail t1 ON tt.maintenance_standard_detail_id = t1.id
        LEFT JOIN mom_eam_maintenance_standard t2 ON tt.maintenance_standard_id = t2.id
        LEFT JOIN mom_eam_maintenance_project t3 ON tt.maintenance_project_id = t3.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t3.maintenance_method
        WHERE t1.del_flag = '0' AND t2.del_flag = '0' AND t3.del_flag = '0' AND t2.type = 'daily' and t1.maintenance_role = 'operator'
        <if test="dailyMaintenanceOrderId != null and dailyMaintenanceOrderId != ''">
            and tt.daily_maintenance_order_id = #{dailyMaintenanceOrderId}
        </if>
    </select>
</mapper>