lyh
昨天 7e8d0345fa4afce3a0c25f0445c43a80657fd04e
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
<?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.EamEquipmentMapper">
 
    <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamEquipment">
        select e.*,
               ext.maintenance_status,
               ext.repair_status,
               ext.latest_second_maintenance,
               ext.next_second_maintenance,
               ext.latest_third_maintenance,
               ext.next_third_maintenance,
               ext.technology_status,
               ext.third_maintenance_period,
               ext.technology_check_period,
               ext.latest_technology_check,
               ext.next_technology_check
        from eam_equipment e
        left join eam_equipment_extend ext
        on e.id = ext.id
        ${ew.customSqlSegment}
    </select>
    <select id="queryList" resultType="org.jeecg.modules.eam.entity.EamEquipment">
        select e.*,
               ext.maintenance_status,
               ext.repair_status,
               ext.latest_second_maintenance,
               ext.next_second_maintenance,
               ext.latest_third_maintenance,
               ext.next_third_maintenance,
               ext.technology_status,
               ext.third_maintenance_period,
               ext.technology_check_period,
               ext.latest_technology_check,
               ext.next_technology_check
        from eam_equipment e
                 left join eam_equipment_extend ext
                           on e.id = ext.id
            ${ew.customSqlSegment}
    </select>
    <select id="queryByEamCenterId" resultType="org.jeecg.modules.eam.entity.EamEquipment">
        select * from
                     eam_equipment
                 where del_flag = 0
        and factory_org_code =(select org_code from eam_base_factory where eam_base_factory.id=#{eamCenterId})
    </select>
    <select id="selectTechnicalEquipmentList" resultType="org.jeecg.modules.eam.entity.EamEquipment">
        select e.*,
               ext.latest_third_maintenance,
               ext.next_third_maintenance,
               ext.technology_status,
               ext.third_maintenance_period,
               ext.technology_check_period,
               ext.latest_technology_check,
               ext.next_technology_check,
               ext.technology_generate_flag,
               ext.third_maintenance_generate_flag
        from eam_equipment e
        left join eam_equipment_extend ext
        on e.id = ext.id
        ${ew.customSqlSegment}
    </select>
 
    <select id="selectThreeMaintenanceEquipmentList" resultType="org.jeecg.modules.eam.entity.EamEquipment">
        select e.*,
               ext.latest_third_maintenance,
               ext.next_third_maintenance,
               ext.technology_status,
               ext.third_maintenance_period,
               ext.technology_check_period,
               ext.latest_technology_check,
               ext.next_technology_check,
               ext.technology_generate_flag,
               ext.third_maintenance_generate_flag
        from eam_equipment e
        left join eam_equipment_extend ext
        on e.id = ext.id
        ${ew.customSqlSegment}
    </select>
    <select id="echartsList" resultType="org.jeecg.modules.eam.dto.EchartsDto">
        SELECT COUNT
               ( t.technology_status ) AS "value",
               item.item_text AS "name",
               item.item_value AS "code",
               ( SELECT COUNT ( a.id ) FROM eam_equipment_extend a WHERE a.technology_status IS NOT NULL
                                                <if test="ids != null and ids != ''">
                                                    AND a.id IN
                                                    <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
                                                        #{id}
                                                    </foreach>
                                                </if>
                                                                   ) AS "total",
               concat (
                       round(
                               ISNULL (
                                       COUNT ( t.id ) / ( SELECT COUNT ( a.id ) FROM eam_equipment_extend a WHERE a.technology_status IS NOT NULL
                                                    <if test="ids != null and ids != ''">
                                                        AND a.id IN
                                                        <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
                                                            #{id}
                                                        </foreach>
                                                    </if>),
                                       0
                               ) * 100,
                               2
                       ),
                       '%'
               ) AS "percentage"
        FROM
            sys_dict c
                LEFT JOIN sys_dict_item item ON c.id = item.dict_id
                LEFT JOIN eam_equipment_extend t ON t.technology_status = item.item_value
                <if test="ids != null and ids != ''">
                    AND t.id IN
                    <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
                        #{id}
                    </foreach>
                </if>
        WHERE
            c.dict_code = 'equipment_technology_status'
        GROUP BY
            item.item_text,
            t.technology_status,
            item.item_value
        ORDER BY
            item.item_value
    </select>
</mapper>