yangys
2024-04-09 5e7afb7c22b702b3ab725d0a762e6f5b8119a9df
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
<?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="com.qianwen.smartman.modules.cps.mapper.DmpVariablesMapper">
 
 
    <select id="listToRealTimeByMachineId" resultType="com.qianwen.smartman.modules.cps.vo.DmpVariablesVO">
        SELECT dmp.name,
               dmp.description,
               dmp.dmp_type
        FROM blade_dmp_variables dmp
        where dmp.machine_id = #{machineId}
    </select>
 
    <select id="getDmpVariablesByWorkstationId" resultType="com.qianwen.smartman.modules.cps.vo.DmpVariablesVO">
        SELECT b.id,
               b.name             as name,
               wcs.data_item      AS description,
               wcs.data_type      AS wcsDataType,
               b.idx              as sort,
               wcs.real_time_data as realTimeData,
               wcs.big_screen     as bigScreen
        FROM blade_workstation_wcs wcs
                 inner JOIN blade_dmp_variables b ON wcs.dmp_variables_id = b.id
        WHERE wcs.is_deleted = 0
          AND wcs.workstation_id = #{workstationId}
        order by b.idx
    </select>
 
    <select id="getVariablesAndWcs" resultType="com.qianwen.smartman.modules.cps.vo.DmpVariablesVO">
        select a.*,
               c.data_type wcsDataType,
               c.data_item,
               c.id        wcsId,
               c.big_screen,
               c.real_time_data,
               c.process_parameter,
               c.usage_id
        from blade_dmp_variables a
                 left join blade_workstation_of_machine b
                           on a.machine_id = b.machine_id and b.workstation_id = #{workstationId}
                 left join blade_workstation_wcs c
                           on b.workstation_id = c.workstation_id and a.id = c.dmp_variables_id and c.is_deleted = 0
        where a.machine_id = #{id}
        order by a.idx
    </select>
 
    <select id="getDmpVariablesByWorkstationIdList"
            resultType="com.qianwen.smartman.modules.cps.vo.DmpStatusVariableVO">
        SELECT wcs.workstation_id workstationId,dv.name variableKey
        FROM blade_workstation_wcs wcs
        JOIN blade_dmp_variables dv ON wcs.dmp_variables_id = dv.id
        WHERE wcs.is_deleted = 0
        AND wcs.data_type = 1
        <if test="workstationIdList != null and workstationIdList.size() > 0">
            AND wcs.workstation_id IN
            <foreach collection="workstationIdList" item="workstationId" open="(" separator="," close=")">
                #{workstationId}
            </foreach>
        </if>
    </select>
    <select id="getDmpVariablesByWorkstationIds" resultType="com.qianwen.smartman.modules.cps.vo.DmpVariablesVO">
        SELECT b.id, b.name as name, wcs.data_item AS description, wcs.data_type AS wcsDataType,
        b.idx as sort, wcs.real_time_data as realTimeData, wcs.big_screen as bigScreen,
        wcs.workstation_id
        FROM blade_workstation_wcs wcs
        inner JOIN blade_dmp_variables b ON wcs.dmp_variables_id = b.id
        WHERE wcs.is_deleted = 0
        <if test="workstationIds != null and workstationIds.size() > 0">
            AND wcs.workstation_id IN
            <foreach collection="workstationIds" item="workstationId" open="(" separator="," close=")">
                #{workstationId}
            </foreach>
        </if>
    </select>
 
</mapper>