“linengliang”
2023-09-13 05af237671e1a4c356fd8bf6cb837f3fe8a3863d
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
<?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.PredictiveWorkOrderMapper">
 
    <select id="getSpecialtyMaintenanceOrderList"  parameterType="Map" resultType="Map">
        SELECT DISTINCT
        t1.id,
        t1.num,
        t1.status,
        t1.maintenance_user_id maintenanceUserId,
        t12.realname maintenanceUserName,
        t2.id as specialtyMaintenancePlanId,
        t2.num AS specialtyMaintenancePlanNum,
        t2.assign_mode assignMode,
        t11.item_text assignModeName,
        t7.item_text AS statusName,
        t5.item_text AS maintenanceMode,
        t4.depart_name AS departName,
        t2.team_id teamId,
        t6.name AS teamName,
        concat(t8.code, '/', t8.name) AS maintenanceCycleName,
        t9.NAME AS maintenanceTypeName,
        t1.plan_start_time as planStartTime,
        t1.plan_end_time as planEndTime,
        t1.actual_start_time as actualStartTime,
        t1.actual_end_time as actualEndTime,
        t10.realname,
        t1.create_time as createTime,
        t1.create_by as createBy
        FROM
        mom_eam_specialty_maintenance_order t1
        LEFT JOIN mom_eam_specialty_maintenance_plan t2 ON t1.specialty_maintenance_plan_id = t2.id
        LEFT JOIN sys_depart t4 ON t2.depart_id = t4.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_method' ) t5 ON t5.item_value = t2.maintenance_mode
        LEFT JOIN mom_base_team t6 ON t2.team_id = t6.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_order_status' ) t7 ON t7.item_value = t1.STATUS
        left join (select * from v_sys_dict where dict_code = 'assign_mode') t11 on t2.assign_mode = t11.item_value
        LEFT JOIN mom_eam_maintenance_cycle t8 ON t8.id = t2.maintenance_cycle_id
        LEFT JOIN mom_eam_maintenance_type t9 ON t9.id = t2.maintenance_type_id
        left join sys_user t10 on t1.recipient_user_id = t10.id
        left join sys_user t12 on t1.maintenance_user_id = t12.id
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t8.del_flag = 0 and t9.del_flag = 0
        <if test="params.num != null and params.num != ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        ORDER BY t1.create_time desc
    </select>
    <select id="pageList" resultType="org.jeecg.modules.eam.entity.PredictiveWorkOrder">
        select
        t1.id id,
        t1.num num,
        t1.status status,
        t1.item_id itemId,
        t1.actual_start_time actualStartTime,
        t1.actual_end_time actualEndTime,
        t1.plan_start_time planStartTime,
        t1.plan_end_time planEndTime,
        t1.create_by createBy,
        t1.create_time createTime,
        t1.maintenance_user_id maintenanceUserId,
        t2.monitor_type monitorType,
        t2.num planNum,
        t2.id workPlanId,
        t2.team_id teamId,
        t2.plan_version version,
        t2.assign_mode assignMode,
        t3.num equipmentNum,
        t3.name equipmentName,
        t3.model model,
        t3.use_id useId,
        t6.actualWorkingHourQuota actualWorkingHourQuota
        from
        mom_eam_predictive_work_order t1
        left join (select * from mom_eam_predictive_work_plan where del_flag = 0) t2
        on t1.work_plan_id = t2.id
        left join (select * from mom_eam_equipment where del_flag = 0) t3
        on t1.equipment_id = t3.id
        left join
        (select
        t4.id,
        ISNULL(SUM(t5.actual_working_hour_quota),0) actualWorkingHourQuota
        from
        mom_eam_predictive_work_order t4
        left join mom_eam_maintenance_order_actual_working_hour t5
        on t4.id = t5.maintenance_order_id
        group by t4.id) t6
        on t6.id = t1.id
        where t1.del_flag = 0
        <if test="num != null and num != ''">
            and t1.num like concat('%',#{num},'%')
        </if>
    </select>
</mapper>