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
<?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.SpecialtyInspectionPlanMapper">
 
    <select id="getSpecialtyInspectionPlan"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.num,
            t1.inspection_cycle_id AS inspectionCycleId,
            concat( t2.CODE, '/', t2.NAME ) AS inspectionCycleName,
            t1.depart_id AS departId,
            concat( t3.org_code, '/', t3.depart_name ) AS useDepartName,
            t1.team_id as teamId,
            t4.name as teamName,
            t1.remark,
            t1.assign_mode as assignMode,
            t5.item_text as assignModeName,
            t1.create_by AS createBy,
            t1.create_time AS createTime,
            t1.update_by AS updateBy,
            t1.update_time AS updateTime
        FROM
            mom_eam_specialty_inspection_plan t1
        LEFT JOIN mom_eam_inspection_cycle t2 ON t1.inspection_cycle_id = t2.id
        LEFT JOIN sys_depart t3 ON t1.depart_id = t3.id
        left join mom_base_team t4 on t1.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 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>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getSpecialtyInspectionStandard"  parameterType="Map" resultType="Map">
        SELECT DISTINCT
            t1.id,
            t1.id AS specialtyInspectionStandardId,
            t1.num,
            t1.version,
            t2.id AS equipmentId,
            t2.num AS equipmentNum,
            t2.NAME AS equipmentName,
            t2.model AS equipmentModel
        FROM
            mom_eam_specialty_inspection_standard t1
        left join mom_eam_specialty_inspection_standard_detail t5 on t1.id = t5.specialty_inspection_standard_id
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        left join sys_depart t3 on t3.id = t2.use_id
        left join mom_eam_inspection_cycle t4 on t5.inspection_cycle_id = t4.id
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t4.del_flag = 0 and t1.version_status = '2'
        <if test="params.useId != null and params.useId != ''">
            and t2.use_id = #{params.useId}
        </if>
        <if test="params.inspectionCycleId != null and params.inspectionCycleId != ''">
            and t5.inspection_cycle_id = #{params.inspectionCycleId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="getSysDepartPages"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.org_code AS orgCode,
            t1.depart_name AS departName
        FROM
            sys_depart t1
        WHERE
            t1.del_flag = '0'
          AND t1.id IN (SELECT DISTINCT use_id AS useId FROM mom_eam_equipment WHERE del_flag = '0' AND use_id IS NOT NULL)
        <if test="params.num != null and params.num != ''">
            and t1.org_code like concat('%',#{params.num},'%')
        </if>
        <if test="params.name != null and params.name != ''">
            and t1.depart_name like concat('%',#{params.name},'%')
        </if>
    </select>
 
</mapper>