qushaowei
2024-09-29 454545bd4207d99d153e263c68f821f856f0e884
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
<?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.EamEquipmentMapper">
 
    <select id="getResumeUseRecordList"  parameterType="Map" resultType="Map">
        select * from (
            SELECT DISTINCT
                t1.id,
                t1.num,
                '设备调入' AS 'type',
                t1.create_time AS createTime,
                t1.create_by AS createBy
            FROM
                mom_eam_equipment_transfer t1
            left join mom_eam_equipment_transfer_in_detail t2 on t1.id = t2.equipment_transfer_id
            where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
 
            UNION
 
            SELECT DISTINCT
                t1.id,
                t1.num,
                '设备调出' AS 'type',
                t1.create_time AS createTime,
                t1.create_by AS createBy
            FROM
                mom_eam_equipment_transfer t1
            left join mom_eam_equipment_transfer_out_detail t2 on t1.id = t2.equipment_transfer_id
            where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
 
            UNION
 
            SELECT DISTINCT
                t1.id,
                t1.num,
                '设备变动' AS 'type',
                t1.create_time AS createTime,
                t1.create_by AS createBy
            FROM
                mom_eam_equipment_change t1
            left join mom_eam_equipment_change_detail t2 on t1.id = t2.equipment_change_id
            where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
        ) as equipmentChange
    </select>
 
    <select id="getResumeInspectionRecordList"  parameterType="Map" resultType="Map">
        SELECT DISTINCT
            t1.id,
            '日常点检' as inspectionType,
            t1.num,
            t1.inspection_time as inspectionTime,
            t3.name as teamName,
            t4.realname as inspectionUserName,
            t1.actual_end_time as actualEndTime
        FROM
            mom_eam_inspection_order t1
        LEFT JOIN mom_eam_daily_inspection_standard t2 ON t1.inspection_standard_id = t2.id
        left join mom_base_team t3 on t1.team_id = t3.id
        left join sys_user t4 on t1.inspection_user_id = t4.id
        left join mom_eam_inspection_cycle t5 on t1.inspection_cycle_id = t5.id
        WHERE t1.del_flag = '0' and t2.del_flag= '0'  and t5.del_flag= '0' and t2.equipment_id = ${params.equipmentId}
 
    </select>
 
    <select id="getResumeMaintenanceRecordList"  parameterType="Map" resultType="Map">
        select * from (
            SELECT DISTINCT
                t1.id,
                '日常保养' as maintenanceType,
                t1.num,
                t4.name as teamName,
                t5.realname as maintenanceuserName,
                t1.actual_start_time as actualStartTime,
                t1.actual_end_time as actualEndTime
            FROM
                mom_eam_daily_maintenance_order t1
            LEFT JOIN mom_eam_daily_maintenance_order_detail t2 ON t1.id = t2.daily_maintenance_order_id
            left join mom_eam_equipment t3 on t1.equipment_id = t3.id
            left join mom_base_team t4 on t3.team_id = t4.id
            left join sys_user t5 on t5.id= t1.maintenance_user_id
            WHERE t1.del_flag = '0' and t2.del_flag= '0'  and t3.del_flag= '0' and t1.equipment_id = #{params.equipmentId}
 
            UNION
 
            SELECT DISTINCT
                t1.id,
                '专业保养' AS maintenanceType,
                t1.num,
                t4.name as teamName,
                t5.realname as maintenanceuserName,
                t1.actual_start_time as actualStartTime,
                t1.actual_end_time as actualEndTime
            FROM
                mom_eam_specialty_maintenance_order t1
            left join mom_eam_specialty_maintenance_order_detail t2 on t1.id = t2.specialty_maintenance_order_id
            left join mom_eam_equipment t3 on t2.equipment_id = t3.id
            left join mom_base_team t4 on t3.team_id = t4.id
            left join sys_user t5 on t5.id= t1.maintenance_user_id
            WHERE t1.del_flag = '0' and t2.del_flag= '0'  and t3.del_flag= '0' and t2.equipment_id = #{params.equipmentId}
        ) as maintenance
    </select>
 
    <select id="getResumeRepairRecordList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            t1.fault_description as faultDescription,
            t1.fault_time as faultTime,
            t2.item_text as maintenanceMethodName,
            t3.name as teamName,
            t4.realname as recipientuserName,
            t1.actual_hour as actualHour,
            t1.actual_start_time AS actualStartTime,
            t1.actual_end_time as  actualEndTime
        FROM
            mom_eam_repair_order t1
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_method' ) t2 ON t2.item_value = t1.maintenance_method
        left join mom_base_team t3 on t1.team_id = t3.id
        left join sys_user t4 on t1.recipient_user_id = t4.id
        WHERE t1.del_flag = '0' and t4.del_flag= '0'  and t3.del_flag= '0' and t1.equipment_id = #{params.equipmentId}
    </select>
 
    <select id="getResumeCalibrationRecordList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            t2.item_text as calibrationTypeName,
            t3.realname as calibrationUserName,
            t1.calibration_time as calibrationTime,
            t1.management_mode as managementMode,
            t1.status
        FROM
            mom_eam_calibration_order t1
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'calibration_type' ) t2 ON t2.item_value = t1.calibration_type
        left join sys_user t3 on t1.calibration_user_id = t3.id
        WHERE t1.del_flag = '0' and t3.del_flag= '0' and t1.equipment_id = #{params.equipmentId}
    </select>
 
    <select id="getResumeChangeRecordList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            (case t1.change_method when 'seal' then '设备封存' when 'unseal' then '设备启封' when 'scrap' then '设备报废' else '设备处置' end) as changeMethod,
            t1.create_by as createBy,
            t1.create_time as createTime
        FROM
            mom_eam_equipment_change t1
        LEFT JOIN mom_eam_equipment_seal_detail t2 ON t1.id = t2.equipment_change_id
        LEFT JOIN mom_eam_equipment_disposal_detail t3 ON t1.id = t3.equipment_change_id
        LEFT JOIN mom_eam_equipment_unseal_detail t4 ON t1.id = t4.equipment_change_id
        LEFT JOIN mom_eam_equipment_scrap_detail t5 ON t1.id = t5.equipment_change_id
        where t1.del_flag = '0'  and (t2.equipment_id = #{params.equipmentId} or t3.equipment_id = #{params.equipmentId} or t4.equipment_id = #{params.equipmentId} or t5.equipment_id = #{params.equipmentId})
    </select>
 
    <select id="pageEquipment"  parameterType="Map" resultType="org.jeecg.modules.eam.entity.Equipment">
        SELECT
        t1.id,
        t1.num,
        t1.name,
        t1.model,
        t1.specification,
        t1.equipment_status equipmentStatus,
        t2.item_text equipmentStatus_dictText
        FROM
        mom_eam_equipment t1
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'equipment_status' ) t2 ON t1.equipment_status = t2.item_value
        WHERE t1.del_flag = '0'
 
    </select>
    <!--        <if test="params.num != 'null' and params.num != ''">-->
    <!--            and t1.num like concat('%',#{params.num},'%')-->
    <!--        </if>-->
    <!--        <if test="params.name != 'null' and params.name != ''">-->
    <!--            and t1.name like concat('%',#{params.name},'%')-->
    <!--        </if>-->
    <select id="getEquipmentList" resultType="org.jeecg.modules.eam.entity.Equipment">
    select
        t1.id id,
        t1.num num,
        t1.name name,
        t1.model model,
        t1.specification specification,
        t1.equipment_status equipmentStatus,
        t1.technology_status technologyStatus,
        t1.asset_number assetNumber,
        t1.equipment_category_id equipmentCategoryId,
        t1.specific_equipment specificEquipment,
        t1.equipment_photo equipmentPhoto,
        t1.constructor_id constructorId,
        t1.supplier_id supplierId,
        t1.factory_number factoryNumber,
        t1.leave_factory_date leaveFactoryDate,
        t1.acceptance_check_date acceptanceCheckDate,
        t1.affiliation_id affiliationId,
        t1.manage_id manageId,
        t1.manager manager,
        t1.use_id useId,
        t1.functionary functionary,
        t1.location location,
        t1.equipment_importance_id equipmentImportanceId,
        t1.process_parameters processParameters,
        t1.process_parameters_template_id processParametersTemplateId,
        t1.precision_parameters precisionParameters,
        t1.precision_parameters_template_id precisionParametersTemplateId,
        t1.verification verification,
        t1.verification_period verificationPeriod,
        t1.last_verification_date lastVerificationDate,
        t1.next_verification_date nextVerificationDate,
        t1.status status,
        t1.remark remark,
        t1.equipment_uda1 equipmentUda1,
        t1.equipment_uda2 equipmentUda2,
        t1.equipment_uda3 equipmentUda3,
        t1.equipment_uda4 equipmentUda4,
        t1.equipment_uda5 equipmentUda5,
        t1.create_by createBy,
        t1.create_time  createTime,
        t1.update_by updateBy,
        t1.update_time updateTime,
        t1.del_flag delFlag,
        t1.team_id teamId,
        t1.source_id sourceId,
        t1.fund_source fundSource,
        t1.factory_no factoryNo,
        t1.mfr mfr,
        t1.source_country sourceCountry,
        t1.gpo gpo,
        t1.key_equipment_identification keyEquipmentIdentification,
        t1.security_configuration securityConfiguration,
        t1.cooling_system coolingSystem,
        t1.fire_extinguisher fireExtinguisher,
        t1.fire_extinguisher_validity_period fireExtinguisherValidityPeriod,
        t1.operating_system operatingSystem,
        t1.system system,
        t1.port port,
        t1.coordinate_num coordinateNum,
        t1.project_approval_no projectApprovalNo,
        t1.standard_a standardA,
        t1.standard_b standardB,
        t1.standard_c standardC,
        t1.standard_d standardD,
        t1.standard_e standardE,
        t1.standard_f standardF,
        t1.factory_model_id factoryModelId,
        t1.work_center_id workCenterId,
        t1.warranty_start warrantyStart,
        t1.warranty_end warrantyEnd,
        t1.property_status propertyStatus,
        t1.check_period checkPeriod,
        t1.next_technology_status_qualification_time nextTechnologyStatusQualificationTime,
        t1.technology_status_qualification_time technologyStatusQualificationTime,
        t1.technology_status_verification_type technologyStatusVerificationType,
        t1.line_id lineId,
        t1.is_meta isMeta,
        t1.id showId,
        t1.is_line isLine,
        t1.is_line_equip isLineEquip,
        t1.is_judging isJudging,
        t1.area_id areaId,
        t3.sumOfEquipment
    from mom_eam_equipment t1
    left join (select  * from mom_eam_equipment_category where del_flag = 0) t2 on t1.equipment_category_id = t2.id
    left join(select  count(id) sumOfEquipment,line_id  from mom_eam_equipment where del_flag=0 group by line_id) t3 on t3.line_id = t1.id
    where t1.del_flag  = 0
        <if test="equipmentCategoryId != null and equipmentCategoryId != ''">
            and t1.equipment_category_id = #{equipmentCategoryId}
        </if>
        <if test="num != null and num != ''">
            and t1.num like concat('%',#{num},'%')
        </if>
        <if test="name != null and name != ''">
            and t1.name like concat('%',#{name},'%')
        </if>
        <if test="model != null and model != ''">
            and t1.model like concat('%',#{model},'%')
        </if>
        <if test="workCenterId != null and workCenterId != ''">
            and t1.work_center_id = #{workCenterId}
        </if>
--         根据areaId查询设备
        <if test="areaId != null and areaId != ''">
            and t1.area_id = #{areaId}
        </if>
        <if test="factoryModelId != null and factoryModelId != ''">
            and t1.factory_model_id = #{factoryModelId}
        </if>
        <if test="manageId != null and manageId != ''">
            and t1.manage_id = #{manageId}
        </if>
        <if test="useId != null and useId != ''">
            and t1.use_id = #{useId}
        </if>
        <if test="equipmentImportanceId != null and  equipmentImportanceId != ''">
            and t1. equipment_importance_id = #{equipmentImportanceId}
        </if>
        <if test="technologyStatus != null and  technologyStatus != ''">
            and t1.technology_status = #{technologyStatus}
        </if>
        <if test="equipmentStatus != null and  equipmentStatus != ''">
            and t1.equipment_status = #{equipmentStatus}
        </if>
        <if test="isLineEquip != null and  isLineEquip != ''">
            and t1.is_line_equip = #{isLineEquip}
        </if>
        <if test="isLine != null and  isLine != ''">
            and t1.is_line = #{isLine}
        </if>
        <if test="specificEquipment != null and  specificEquipment != ''">
            and t1.specific_equipment = #{specificEquipment}
        </if>
        <if test="equipNums.size!=0">
            and t1.num in
            <foreach collection="equipNums" open="(" separator="," close=")" item="num">
                #{num}
            </foreach>
        </if>
        <if test="warrantyStart != null">
            and DATEDIFF(day,t1.warranty_start,#{warrantyStart})=0
        </if>
        <if test="warrantyEnd != null">
            and DATEDIFF(day,t1.warranty_end,#{warrantyEnd})=0
        </if>
        <if test="sql != null and sql != ''">
            and t2.equipment_category_uda1 = #{sql}
        </if>
        <if test="lineId != null and lineId != ''">
            and t1.line_id = #{lineId}
        </if>
        order by t1.create_time desc
    </select>
 
    <select id="getEquipmentTZList" resultType="org.jeecg.modules.eam.entity.Equipment">
        select
        t1.id id,
        t1.num num,
        t1.name name,
        t1.model model,
        t1.specification specification,
        t1.equipment_status equipmentStatus,
        t1.technology_status technologyStatus,
        t1.asset_number assetNumber,
        t1.equipment_category_id equipmentCategoryId,
        t1.specific_equipment specificEquipment,
        t1.equipment_photo equipmentPhoto,
        t1.constructor_id constructorId,
        t1.supplier_id supplierId,
        t1.factory_number factoryNumber,
        t1.leave_factory_date leaveFactoryDate,
        t1.acceptance_check_date acceptanceCheckDate,
        t1.affiliation_id affiliationId,
        t1.manage_id manageId,
        t1.manager manager,
        t1.use_id useId,
        t1.functionary functionary,
        t1.location location,
        t1.equipment_importance_id equipmentImportanceId,
        t1.process_parameters processParameters,
        t1.process_parameters_template_id processParametersTemplateId,
        t1.precision_parameters precisionParameters,
        t1.precision_parameters_template_id precisionParametersTemplateId,
        t1.verification verification,
        t1.verification_period verificationPeriod,
        t1.last_verification_date lastVerificationDate,
        t1.next_verification_date nextVerificationDate,
        t1.status status,
        t1.remark remark,
        t1.equipment_uda1 equipmentUda1,
        t1.equipment_uda2 equipmentUda2,
        t1.equipment_uda3 equipmentUda3,
        t1.equipment_uda4 equipmentUda4,
        t1.equipment_uda5 equipmentUda5,
        t1.create_by createBy,
        t1.create_time  createTime,
        t1.update_by updateBy,
        t1.update_time updateTime,
        t1.del_flag delFlag,
        t1.team_id teamId,
        t1.source_id sourceId,
        t1.fund_source fundSource,
        t1.factory_no factoryNo,
        t1.mfr mfr,
        t1.source_country sourceCountry,
        t1.gpo gpo,
        t1.key_equipment_identification keyEquipmentIdentification,
        t1.security_configuration securityConfiguration,
        t1.cooling_system coolingSystem,
        t1.fire_extinguisher fireExtinguisher,
        t1.fire_extinguisher_validity_period fireExtinguisherValidityPeriod,
        t1.operating_system operatingSystem,
        t1.system system,
        t1.port port,
        t1.coordinate_num coordinateNum,
        t1.project_approval_no projectApprovalNo,
        t1.standard_a standardA,
        t1.standard_b standardB,
        t1.standard_c standardC,
        t1.standard_d standardD,
        t1.standard_e standardE,
        t1.standard_f standardF,
        t1.factory_model_id factoryModelId,
        t1.work_center_id workCenterId,
        t1.warranty_start warrantyStart,
        t1.warranty_end warrantyEnd,
        t1.property_status propertyStatus,
        t1.check_period checkPeriod,
        t1.next_technology_status_qualification_time nextTechnologyStatusQualificationTime,
        t1.technology_status_qualification_time technologyStatusQualificationTime,
        t1.technology_status_verification_type technologyStatusVerificationType,
        t1.second_maintenance_time secondMaintenanceTime,
        t1.third_maintenance_time thirdMaintenanceTime,
        t1.next_third_maintenance_time nextThirdMaintenanceTime,
        t1.line_id lineId,
        t1.is_meta isMeta,
        t1.id showId,
        t1.is_line isLine,
        t1.is_line_equip isLineEquip,
        t1.is_judging isJudging,
        t1.area_id areaId,
        t3.sumOfEquipment
        from mom_eam_equipment t1
        left join (select  * from mom_eam_equipment_category where del_flag = 0) t2 on t1.equipment_category_id = t2.id
        left join(select  count(id) sumOfEquipment,line_id  from mom_eam_equipment where del_flag=0 group by line_id) t3 on t3.line_id = t1.id
        where t1.del_flag  = 0
        <if test="equipmentCategoryId != null and equipmentCategoryId != ''">
            and t1.equipment_category_id = #{equipmentCategoryId}
        </if>
        <if test="num != null and num != ''">
            and t1.num like concat('%',#{num},'%')
        </if>
        <if test="name != null and name != ''">
            and t1.name like concat('%',#{name},'%')
        </if>
        <if test="model != null and model != ''">
            and t1.model like concat('%',#{model},'%')
        </if>
        <if test="workCenterIds != null">
            and t1.work_center_id in
            <foreach collection="workCenterIds" open="(" separator="," close=")" item="workCenterId">
                #{workCenterId}
            </foreach>
        </if>
        --         根据areaId查询设备
        <if test="areaId != null and areaId != ''">
            and t1.area_id = #{areaId}
        </if>
        <if test="factoryModelId != null and factoryModelId != ''">
            and t1.factory_model_id = #{factoryModelId}
        </if>
        <if test="manageId != null and manageId != ''">
            and t1.manage_id = #{manageId}
        </if>
        <if test="useId != null and useId != ''">
            and t1.use_id = #{useId}
        </if>
        <if test="equipmentImportanceId != null and  equipmentImportanceId != ''">
            and t1. equipment_importance_id = #{equipmentImportanceId}
        </if>
        <if test="technologyStatus != null and  technologyStatus != ''">
            and t1.technology_status = #{technologyStatus}
        </if>
        <if test="equipmentStatus != null and  equipmentStatus != ''">
            and t1.equipment_status = #{equipmentStatus}
        </if>
        <if test="isLineEquip != null and  isLineEquip != ''">
            and t1.is_line_equip = #{isLineEquip}
        </if>
        <if test="isLine != null and  isLine != ''">
            and t1.is_line = #{isLine}
        </if>
        <if test="specificEquipment != null and  specificEquipment != ''">
            and t1.specific_equipment = #{specificEquipment}
        </if>
        <if test="equipNums.size!=0">
            and t1.num in
            <foreach collection="equipNums" open="(" separator="," close=")" item="num">
                #{num}
            </foreach>
        </if>
        <if test="warrantyStart != null">
            and DATEDIFF(day,t1.warranty_start,#{warrantyStart})=0
        </if>
        <if test="warrantyEnd != null">
            and DATEDIFF(day,t1.warranty_end,#{warrantyEnd})=0
        </if>
        <if test="sql != null and sql != ''">
            and t2.equipment_category_uda1 = #{sql}
        </if>
        <if test="lineId != null and lineId != ''">
            and t1.line_id = #{lineId}
        </if>
        order by t1.create_time desc
    </select>
<!--    order by (CASE WHEN t1.is_meta='yes' then GETDATE() else t1.create_time end) desc-->
    <select id="getStandardList" resultType="org.jeecg.modules.eam.entity.DailyInspectionStandardDetail">
        select t9.* from ( select
           t1.id id,
           t5.name projectName,
           '' as maintenanceRole,
           t5.detection_standard standard,
           '1' as type,
           t6.name cycleName,
           t2.equipment_id equipmentId
           from mom_eam_daily_inspection_standard_detail t1
           left join mom_eam_daily_inspection_standard t2
           on t2.id = t1.daily_inspection_standard_id
           left join mom_eam_inspection_project t5
           on t5.id = t1.inspection_project_id
           left join mom_eam_maintenance_cycle t6
           on t6.id = t1.inspection_cycle_id
           where  t2.version_status = '2'
           union all
           select
           t3.id id,
           t7.name projectName,
           t3.maintenance_role maintenanceRole,
           t7.standard standard,
           t8.maintenance_type type,
           t8.name cycleName,
           t4.equipment_id equipmentId
           from mom_eam_maintenance_standard_detail t3
           left join mom_eam_maintenance_standard t4
           on t4.id = t3.maintenance_standard_id
           left join mom_eam_maintenance_project t7
           on t7.id = t3.maintenance_project_id
           left join mom_eam_maintenance_cycle t8
           on t8.id = t3.maintenance_cycle_id
           where  t4.version_status = '2') t9 where
           t9.equipmentId = #{mainId}
           and t9.type = #{type}
           order by t9.type
    </select>
 
    <select id="getEquipmentListAllStandard"  parameterType="Map" resultType="Map">
        SELECT
        t1.id,
        t2.name as categoryName,
        t1.num as equipmentNum,
        t1.name as equipmentName,
        t1.model as equipmentModel,
        t1.equipment_importance_id as abc,
        t1.precision_parameters as precisionParameters,
        t1.precision_parameters_template_id as precisionParametersTemplateId,
        t3.depart_name as departName,
        t4.item_text as technologyStatus,
        t5.item_text as specificEquipment
        FROM
        mom_eam_equipment t1
        LEFT JOIN mom_eam_equipment_category t2 ON t1.equipment_category_id = t2.id
        LEFT JOIN sys_depart t3 ON t1.use_id = t3.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t4 ON t4.item_value = t1.technology_status
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'specific_equipment' ) t5 ON t5.item_value = t1.specific_equipment
        WHERE t1.del_flag = '0'
        <if test="params.num != null and params.num != ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.name != null and params.name != ''">
            and t1.name like concat('%',#{params.name},'%')
        </if>
        <if test="params.model != null and params.model != ''">
            and t1.model like concat('%',#{params.model},'%')
        </if>
        <if test="params.useId != null and params.useId != ''">
            and t1.use_id = #{params.useId}
        </if>
        <if test="params.equipmentImportanceId != null and  params.equipmentImportanceId != ''">
            and t1. equipment_importance_id = #{params.equipmentImportanceId}
        </if>
        <if test="params.technologyStatus != null and  params.technologyStatus != ''">
            and t1.technology_status = #{params.technologyStatus}
        </if>
        <if test="params.equipmentStatus != null and  params.equipmentStatus != ''">
            and t1.equipment_status = #{params.equipmentStatus}
        </if>
        <if test="params.specificEquipment != null and  params.specificEquipment != ''">
            and t1.specific_equipment = #{params.specificEquipment}
        </if>
        <if test="params.factoryModelId != null and params.factoryModelId != ''">
            and t1.factory_model_id = #{params.factoryModelId}
        </if>
        <if test="params.equipmentCategoryId != null and params.equipmentCategoryId != ''">
            and t1.equipment_category_id = #{params.equipmentCategoryId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
</mapper>