lius
2023-07-27 40c22341b74d5bec60cbec08e338d8c8b22fcc92
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
<?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.MdcEquipmentRunningSectionMapper">
 
    <!--查询单台设备最后时间段记录(非报警)-->
    <select id="getMaxNormal" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT TOP 1 * FROM mdc_equipment_running_section WHERE equipment_id = #{equipmentId} AND status <![CDATA[ <> ]]> '22' ORDER BY end_time DESC
    </select>
 
    <!--获取计算段时间后的最后一条记录(报警)-->
    <select id="getMaxError" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT TOP 1 * FROM mdc_equipment_running_section WHERE equipment_id = #{equipmentId} AND status = '22' ORDER BY end_time DESC
    </select>
 
    <!--获取设备运行记录最早的数据-->
    <select id="getFirstData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT TOP 1 * FROM mdc_equipment_running_section WHERE equipment_id = #{equipmentId} ORDER BY start_time
    </select>
 
    <!--查询设备单日运行状态时间段记录-->
    <select id="listForEquipmentStatisticalInfo" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT
            *
        FROM
            mdc_equipment_running_section
        WHERE
            equipment_id = #{ equipmentId }
            AND  (start_time &lt;= #{ endDate } AND end_time &gt;= #{ startDate })
        ORDER BY
            start_time
    </select>
 
    <!--计算一段时间内的数据-->
    <select id="listEquipmentRunningSection" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT
            *
        FROM
            mdc_equipment_running_section
        WHERE
            equipment_id = #{ equipmentId }
            AND  (start_long &lt;= #{ endLong } AND end_long &gt;= #{ startLong })
        ORDER BY
            start_time
    </select>
 
    <!--计算一段时间内的运行数据-->
    <select id="listEquipmentRunningSectionRun" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT
            *
        FROM
            mdc_equipment_running_section
        WHERE
            equipment_id = #{ equipmentId }
            AND status <![CDATA[ <> ]]> '22'
            AND  (start_long &lt;= #{ endLong } AND end_long &gt;= #{ startLong })
        ORDER BY
            start_time
    </select>
 
    <!--计算一段时间内的故障数据-->
    <select id="listEquipmentRunningSectionError" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
        SELECT
            *
        FROM
            mdc_equipment_running_section
        WHERE
            equipment_id = #{ equipmentId }
            AND status = '22'
            AND  (start_long &lt;= #{ endLong } AND end_long &gt;= #{ startLong })
        ORDER BY
            start_time
    </select>
 
 
</mapper>