Lius
2025-03-04 79bb09af27e6b2e6b4b898af7a1922e9c82f8762
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
<?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.mdc.mapper.MdcWorkshopInfoMapper">
 
 
    <select id="getBigScreenInfo" resultType="org.jeecg.modules.mdc.dto.MdcBigScreenEquipmentDto">
        WITH LatestEquipmentLog AS (
            SELECT
                EquipmentID,
                MAX(CollectTime) AS maxgdtime
            FROM
                EquipmentLog
            GROUP BY
                EquipmentID
        )
        SELECT
            mew.id AS id,
            a.EquipmentID AS equipmentId,
            me.equipment_name AS equipmentName,
            me.equipment_type AS equipmentType,
            met.equipment_type_pictures AS equipmentImage,
            a.Oporation AS oporation,
            me.equipment_status AS equipmentStatus,
            mew.coordinate_left AS coordinateLeft,
            mew.coordinate_top AS coordinateTop,
            mew.vw AS vw,
            mew.vh AS vh,
            me.id AS equId
        FROM
            EquipmentLog a
                INNER JOIN LatestEquipmentLog b ON a.EquipmentID = b.EquipmentID AND a.CollectTime = b.maxgdtime
                INNER JOIN mdc_workshop_equipment mew ON mew.equipment_id = a.EquipmentID
                INNER JOIN mdc_equipment me ON me.equipment_id = a.EquipmentID
                INNER JOIN mdc_equipment_type met ON me.equipment_type = met.equipment_type_name
                INNER JOIN mdc_workshop_info mwi ON mew.workshop_id = mwi.id
        WHERE
            mwi.production_id = #{productionId}
    </select>
 
    <select id="listByUser" resultType="org.jeecg.modules.mdc.entity.MdcWorkshopInfo">
        SELECT
            DISTINCT t1.*
        FROM
            mdc_workshop_info t1
                LEFT JOIN sys_permission t2 ON t1.perms = t2.perms
                LEFT JOIN sys_role_permission t3 ON t2.id = t3.permission_id
                LEFT JOIN sys_role t4 ON t4.id = t3.role_id
                LEFT JOIN sys_user_role t5 ON t5.role_id = t4.id
        WHERE
            t5.user_id = #{ userId }
    </select>
 
    <select id="productionListByUser" resultType="org.jeecg.modules.system.entity.MdcProduction">
        SELECT
            t1.*
        FROM
            mdc_production t1
                 LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id
        WHERE
            t1.org_type = 2 AND t2.user_id = #{userId}
        ORDER BY t1.production_name
    </select>
</mapper>