cuijian
2023-08-19 bdd0875d4b13a3f1ef472f64d4b6a95e0ef64b22
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
<?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.EquipmentChangeDetailMapper">
 
 
    <select id="getEquipmentChangeDetailList" parameterType="Map" resultType="Map">
        SELECT
        t1.id,
        t1.equipment_change_id as equipmentChangeId,
        t1.change_type as changeType,
        t1.change_reason as changeReason,
        t1.before_depart_id as beforeDepartId,
        t1.after_depart_id as afterDepartId,
        t1.before_manager as beforeManager,
        t1.after_manager as afterManager,
        t1.before_usage_depart_id as beforeUsageDepartId,
        t1.after_usage_depart_id as afterUsageDepartId,
        t1.before_team_id as beforeTeamId,
        t1.after_team_id as afterTeamId,
        t1.before_functionary as beforeFunctionary,
        t1.after_functionary as afterFunctionary,
        t1.before_location as beforeLocation,
        t1.after_location as afterLocation,
        t1.before_equipment_status as beforeEquipmentStatus,
        t1.after_equipment_status as afterEquipmentStatus,
        t1.before_technology_status as beforeTechnologyStatus,
        t1.after_technology_status as afterTechnologyStatus,
        t1.remark,
        t1.equipment_id as equipmentId,
        t2.id AS equipmentId,
        t2.num as equipmentNum,
        t2.name as equipmentName,
        t2.id as equipmentId,
        t2.model as model,
        t2.specification as specification,
        t1.update_by as updateBy,
        t1.update_time as updateTime
 
        FROM
        mom_eam_equipment_change_detail t1
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        <if test="equipmentChangeId != null and equipmentChangeId != ''">
            WHERE t1.del_flag = 0 and t1.equipment_change_id = #{equipmentChangeId}
        </if>
 
        ORDER BY t1.create_time desc
    </select>
 
 
    <select id="getEquipmentChangeDetailById" parameterType="Map" resultType="Map">
        SELECT
        t1.id,
        t1.equipment_change_id as equipmentChangeId,
        t1.change_type as changeType,
        t1.change_reason as changeReason,
        t1.before_depart_id as beforeDepartId,
        t1.after_depart_id as afterDepartId,
        t1.before_manager as beforeManager,
        t1.after_manager as afterManager,
        t1.before_usage_depart_id as beforeUsageDepartId,
        t1.after_usage_depart_id as afterUsageDepartId,
        t1.before_team_id as beforeTeamId,
        t1.after_team_id as afterTeamId,
        t1.before_functionary as beforeFunctionary,
        t1.after_functionary as afterFunctionary,
        t1.before_location as beforeLocation,
        t1.after_location as afterLocation,
        t1.before_equipment_status as beforeEquipmentStatus,
        t1.after_equipment_status as afterEquipmentStatus,
        t1.before_technology_status as beforeTechnologyStatus,
        t1.after_technology_status as afterTechnologyStatus,
        t1.remark,
        t1.equipment_id as equipmentId,
        t2.id AS equipmentId,
        t2.num as equipmentNum,
        t2.name as equipmentName,
        t2.id as equipmentId,
        t2.model as model,
        t2.specification as specification,
        t1.update_by as updateBy,
        t1.update_time as updateTime,
        t3.id AS beforeUsageDepartId,
        t3.depart_name as beforeUsageDepartName,
        t4.id AS afterUsageDepartId,
        t4.depart_name as afterUsageDepartName,
        t5.id AS beforeManager,
        t5.realname as beforeManagerName,
        t6.id AS afterManager,
        t6.realname as afterManagerName,
        t7.id AS beforeDepartId,
        t7.depart_name as beforeDepartName,
        t8.id AS afterDepartId,
        t8.depart_name as afterDepartName,
        t9.id AS beforeFunctionary,
        t9.realname as beforeFunctionaryName,
        t10.id AS afterFunctionary,
        t10.realname as afterFunctionaryName,
        t11.item_text as afterEquipmentStatusName,
        t12.item_text as afterTechnologyStatusName,
        t12.item_text as changeTypeName
        FROM
        mom_eam_equipment_change_detail t1
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        LEFT JOIN sys_depart t3 ON t1.before_usage_depart_id = t3.id
        LEFT JOIN sys_depart t4 ON t1.after_usage_depart_id = t4.id
        LEFT JOIN sys_user t5 ON t1.before_manager = t5.id
        LEFT JOIN sys_user t6 ON t1.after_manager = t6.id
        LEFT JOIN sys_depart t7 ON t1.before_depart_id = t7.id
        LEFT JOIN sys_depart t8 ON t1.after_depart_id = t8.id
        LEFT JOIN sys_user t9 ON t1.before_functionary = t9.id
        LEFT JOIN sys_user t10 ON t1.after_functionary = t10.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'equipment_status' ) t11 ON t11.item_value = t1.after_equipment_status
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status' ) t12 ON t12.item_value = t1.after_technology_status
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'change_type' ) t13 ON t13.item_value = t1.change_type
        WHERE t1.del_flag = 0
        <if test="params.equipmentChangeId != null and params.equipmentChangeId != ''">
            and t1.equipment_change_id = #{params.equipmentChangeId}
        </if>
 
        ORDER BY t1.create_time desc
    </select>
 
    <select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.eam.entity.EquipmentChangeDetail">
        SELECT *
        FROM  mom_eam_equipment_change_detail
        WHERE
            equipment_change_id = #{mainId}
    </select>
</mapper>