zenglf
2023-08-18 499d6294b4b7881c5797a59a183c5fc0105599dd
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
<?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.DailyInspectionStandardMapper">
 
    <select id="getInspectionStandardPage"  parameterType="String" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            t1.version,
            t1.version_status as versionStatus,
            t5.item_text as versionStatusName,
            t1.assign_mode as assignMode,
            t6.item_text as assignModeName,
            t1.equipment_id as equipmentId,
            t2.num AS equipmentNum,
            t2.NAME AS equipmentName,
            t2.model as equipmentModel,
            t1.create_by as createBy,
            t1.create_time as createTime,
            t1.update_by as updateBy,
            t1.update_time as updateTime,
            t3.depart_name as useDepartName,
            t2.use_id as useId,
            t4.id as teamId,
            t4.name as teamName
        FROM
            mom_eam_daily_inspection_standard t1
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        left join sys_depart t3 on t2.use_id = t3.id
        left join mom_base_team t4 on t2.team_id = t4.id
        left join (select * from v_sys_dict where dict_code = 'version_status') t5 on t1.version_status = t5.item_value
        left join (select * from v_sys_dict where dict_code = 'assign_mode') t6 on t1.assign_mode = t6.item_value
        where t1.del_flag = 0
        <if test="num != 'null' and num != ''">
            and t1.num like concat('%',#{num},'%')
        </if>
        <if test="name != 'null' and name != ''">
            and t2.name like concat('%',#{name},'%')
        </if>
        <if test="versionStatus != 'null' and versionStatus != ''">
            and t1.version_status like concat('%',#{versionStatus},'%')
        </if>
        <if test="versionStatus == 'null' ">
            and t1.version_status='2'
        </if>
        ORDER BY t1.create_time desc
    </select>
    <select id="getInspectionStandardMapList" resultType="java.util.Map">
        SELECT
        t1.id,
        t1.num,
        t1.equipment_id as equipmentId,
        t2.num AS equipmentNum,
        t2.NAME AS equipmentName,
        t2.model as equipmentModel,
        t1.create_by as createBy,
        t1.create_time as createTime,
        t1.update_by as updateBy,
        t1.update_time as updateTime
        FROM
        mom_eam_daily_inspection_standard t1
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        where t1.del_flag = 0
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getDepartByEquipment"  parameterType="Map" resultType="Map">
        SELECT DISTINCT
            t2.id,
            t2.org_code AS departNum,
            t2.depart_name AS departName
        FROM
            mom_eam_equipment t1
        LEFT JOIN sys_depart t2 ON t1.use_id = t2.id
        LEFT JOIN mom_sys_data_version t3 ON t2.id = t3.business_id
        WHERE t1.del_flag = '0'
          AND t3.version_status = '2'
          AND t1.use_id IS NOT NULL
        <if test="params.num!=null and params.num!= ''">
            and t2.org_code like concat('%',#{params.num},'%')
        </if>
        <if test="params.name!=null and params.name!= ''">
            and t2.depart_name like concat('%',#{params.name},'%')
        </if>
    </select>
 
    <select id="findInspectionStandardList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            t1.version,
            t1.equipment_id as equipmentId,
            t2.num AS equipmentNum,
            t2.NAME AS equipmentName,
            t2.model as equipmentModel,
            t2.specification as equipmentSpecification,
            t3.depart_name as useDepartName,
            t2.use_id as useId,
            t4.id as teamId,
            t4.name as teamName,
            t1.assign_mode as assignMode,
            t5.item_text as  assignModeName
        FROM
            mom_eam_daily_inspection_standard t1
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        left join sys_depart t3 on t2.use_id = t3.id
        left join mom_base_team t4 on t2.team_id = t4.id
        left join (select * from v_sys_dict where dict_code = 'assign_mode') t5 on t1.assign_mode = t5.item_value
        where t1.del_flag = 0 and t1.version_status='2'
        <if test="params.num!=null and params.num!= ''">
            and t1.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.equipmentNum!=null and params.equipmentNum!= ''">
            and t2.num like concat('%',#{params.equipmentNum},'%')
        </if>
        <if test="params.equipmentName!=null and params.equipmentName!= ''">
            and t2.name like concat('%',#{params.equipmentName},'%')
        </if>
        ORDER BY t1.create_time desc
    </select>
</mapper>