qushaowei
2024-07-12 15ae1e3b5cda40a8248a1addf4a64c1e0a9e2b13
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="org.jeecg.modules.eam.mapper.MaintenanceStandardDetailMapper">
 
    <select id="getMaintenanceStandardDetailList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.location,
            t1.photo photo,
            t1.maintenance_require AS maintenanceRequire,
            t1.maintenance_mode AS maintenanceMode,
            t2.id AS maintenanceProjectId,
            t2.name,
            t2.standard,
            t4.item_text AS maintenanceMethodName,
            t2.maintenance_tool AS maintenanceTool,
            t2.working_hour_quota AS workingHourQuota,
            t3.id as maintenanceCycleId,
            t3.NAME AS maintenanceCycleName,
            t5.NAME AS maintenanceSpecialtyName,
            t7.item_value as maintenanceRole
        FROM
            mom_eam_maintenance_standard_detail t1
        LEFT JOIN mom_eam_maintenance_project t2 ON t1.maintenance_project_id = t2.id
        LEFT JOIN mom_eam_maintenance_cycle t3 ON t1.maintenance_cycle_id = t3.id
        LEFT JOIN mom_eam_maintenance_specialty t5 ON t5.id = t2.maintenance_specialty_id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t2.maintenance_method
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_role' ) t7 ON t7.item_value = t1.maintenance_role
        WHERE t1.del_flag = 0
        <if test="maintenanceStandardId != null and maintenanceStandardId != ''">
            and t1.maintenance_standard_id = #{maintenanceStandardId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getMaintenanceStandardDetailListByIds"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.location,
            t1.photo photo,
            t1.maintenance_require AS maintenanceRequire,
            t1.maintenance_mode AS maintenanceMode,
            t2.id AS maintenanceProjectId,
            t2.name,
            t2.standard,
            t4.item_text AS maintenanceMethodName,
            t2.maintenance_tool AS maintenanceTool,
            t2.working_hour_quota AS workingHourQuota,
            t3.id as maintenanceCycleId,
            t3.NAME AS maintenanceCycleName,
            t5.NAME AS maintenanceSpecialtyName
        FROM
            mom_eam_maintenance_standard_detail t1
        LEFT JOIN mom_eam_maintenance_project t2 ON t1.maintenance_project_id = t2.id
        LEFT JOIN mom_eam_maintenance_cycle t3 ON t1.maintenance_cycle_id = t3.id
        LEFT JOIN mom_eam_maintenance_specialty t5 ON t5.id = t2.maintenance_specialty_id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t2.maintenance_method
        WHERE t1.del_flag = 0
        <if test="ids != null and ids !=''">
            and  (t1.id in
            <foreach collection='ids' index='index' item='item' open='(' separator=',' close=')'>#{item}</foreach>
            )
        </if>
        <if test="ids == null and ids ==''">
            and t1.id = '-1'
        </if>
    </select>
 
    <select id="getMaintenanceStandardDetailById"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.location,
            t1.photo photo,
            t1.maintenance_require AS maintenanceRequire,
            t6.item_text AS maintenanceModeName,
            t7.item_text as maintenanceRoleName,
            t2.id AS maintenanceProjectId,
            t2.name,
            t2.standard,
            t4.item_text AS maintenanceMethodName,
            t2.maintenance_tool AS maintenanceTool,
            t2.working_hour_quota AS workingHourQuota,
            t3.name as maintenanceCycleName,
            t5.NAME AS maintenanceSpecialtyName
        FROM
            mom_eam_maintenance_standard_detail t1
        LEFT JOIN mom_eam_maintenance_project t2 ON t1.maintenance_project_id = t2.id
        LEFT JOIN mom_eam_maintenance_cycle t3 ON t1.maintenance_cycle_id = t3.id
        LEFT JOIN mom_eam_maintenance_specialty t5 ON t5.id = t2.maintenance_specialty_id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_project_method' ) t4 ON t4.item_value = t2.maintenance_method
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_method' ) t6 ON t6.item_value = t1.maintenance_mode
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_role' ) t7 ON t7.item_value = t1.maintenance_role
        WHERE t1.del_flag = 0
        <if test="params.maintenanceStandardId != null and params.maintenanceStandardId != ''">
            and t1.maintenance_standard_id = #{params.maintenanceStandardId}
        </if>
        ORDER BY t1.create_time desc
    </select>
</mapper>