2021与蓝度共同重构项目,服务端
Van333
2022-12-29 727a69f859060093e685582fa10e5de82dcc138a
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
<?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.sandu.ximon.dao.mapper.PlcReportDataMapper">
 
    <resultMap type="com.sandu.ximon.dao.domain.PlcReportData" id="plcReportDataMap">
        <result property="reportDataId" column="report_data_id"/>
        <result property="deviceCode" column="device_code"/>
        <result property="deviceTemperature" column="device_temperature"/>
        <result property="phase" column="phase"/>
        <result property="voltageA" column="voltage_A"/>
        <result property="voltageB" column="voltage_B"/>
        <result property="voltageC" column="voltage_C"/>
        <result property="electricCurrentA" column="electric_current_A"/>
        <result property="electricCurrentB" column="electric_current_B"/>
        <result property="electricCurrentC" column="electric_current_C"/>
        <result property="activePowerAll" column="active_power_All"/>
        <result property="activePowerA" column="active_power_A"/>
        <result property="activePowerB" column="active_power_B"/>
        <result property="activePowerC" column="active_power_C"/>
        <result property="reactivePowerAll" column="reactive_power_All"/>
        <result property="reactivePowerA" column="reactive_power_A"/>
        <result property="reactivePowerB" column="reactive_power_B"/>
        <result property="reactivePowerC" column="reactive_power_C"/>
        <result property="apparentPowerAll" column="apparent_power_All"/>
        <result property="apparentPowerA" column="apparent_power_A"/>
        <result property="apparentPowerB" column="apparent_power_B"/>
        <result property="apparentPowerC" column="apparent_power_C"/>
        <result property="powerFactorAll" column="power_factor_All"/>
        <result property="powerFactorA" column="power_factor_A"/>
        <result property="powerFactorB" column="power_factor_B"/>
        <result property="powerFactorC" column="power_factor_C"/>
        <result property="totalPositiveUsingPower" column="total_positive_using_power"/>
        <result property="totalReverseUsingPower" column="total_reverse_using_power"/>
        <result property="lightIntensity" column="light_intensity"/>
        <result property="control1" column="control_1"/>
        <result property="status1" column="status_1"/>
        <result property="control2" column="control_2"/>
        <result property="status2" column="status_2"/>
        <result property="control3" column="control_3"/>
        <result property="status3" column="status_3"/>
        <result property="controlN" column="control_n"/>
        <result property="statusN" column="status_n"/>
        <result property="createTime1" column="create_time1"/>
        <result property="updateTime1" column="update_time1"/>
    </resultMap>
    <select id="getNewestReportByDeviceCode" resultMap="plcReportDataMap"
            >
        SELECT
        t1.*
        FROM
        plc_report_data t1
        JOIN (
        SELECT
        MAX( report_data_id ) AS report_data_id
        FROM
        plc_report_data
        WHERE device_code IN
        <foreach collection="deviceCodeList" open="(" close=")" separator="," item="deviceCode">
            #{deviceCode}
        </foreach>
        GROUP BY device_code
        ) AS t2 USING ( report_data_id )
 
    </select>
 
 
</mapper>