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
<?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.SpecialtyMaintenancePlanMapper">
 
    <select id="getSpecialtyMaintenancePlan"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            t1.maintenance_cycle_id AS maintenanceCycleId,
            concat(t2.code, '/', t2.name) as maintenanceCycleName,
            t1.depart_id as departId,
            t4.depart_name as departName,
            t1.team_id as teamId,
            t5.name as teamName,
            t3.id as maintenanceTypeId,
            t3.name as maintenanceTypeName,
            t1.maintenance_mode as maintenanceMode,
            t6.item_text as maintenanceModeName,
            t1.remark,
            t1.assign_mode assignMode,
            t7.item_text assignModeName,
            t1.status,
            t1.create_by as createBy,
            t1.create_time as createTime,
            t1.update_by as updateBy,
            t1.update_time as updateTime
        FROM
            mom_eam_specialty_maintenance_plan t1
        LEFT JOIN mom_eam_maintenance_cycle t2 ON t1.maintenance_cycle_id = t2.id
        LEFT JOIN mom_eam_maintenance_type t3 ON t1.maintenance_type_id = t3.id
        LEFT JOIN sys_depart t4 ON t1.depart_id = t4.id
        LEFT JOIN mom_base_team t5 ON t1.team_id = t5.id
        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 = 'assign_mode') t7 on t1.assign_mode = t7.item_value
        where t1.del_flag = 0 and t2.del_flag = 0 and t3.del_flag = 0
        <if test="params.num != null and params.num != ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.id != null and params.id != ''">
            and t1.id = #{params.id}
        </if>
        <if test="params.status != null and params.status != ''">
            and t1.status = #{params.status}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getSpecialtyMaintenanceStandard"  parameterType="Map" resultType="Map">
        SELECT DISTINCT
            t2.id,
            t2.num,
            t2.version version,
            t2.version_status versionStatus,
            t5.item_text versionStatusName,
            t2.assign_mode assignMode,
            t3.id as equipmentId,
            t3.num AS equipmentNum,
            t3.NAME AS equipmentName,
            t3.model AS equipmentModel
        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_equipment t3 ON t2.equipment_id = t3.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 = 'version_status') t5 on t2.version_status = t5.item_value
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t3.del_flag = 0 and t4.del_flag = 0 and t2.type = 'specialty'
        <if test="params.useId != null and params.useId != ''">
            and t3.use_id = #{params.useId}
        </if>
        <if test="params.maintenanceCycleId != null and params.maintenanceCycleId != ''">
            and t1.maintenance_cycle_id = #{params.maintenanceCycleId}
        </if>
        <if test="params.maintenanceMode != null and params.maintenanceMode != ''">
            and t1.maintenance_mode = #{params.maintenanceMode}
        </if>
        <if test="params.versionStatus != null and params.versionStatus != ''">
            and t2.version_status = #{params.versionStatus}
        </if>
    </select>
 
</mapper>