工业级运维app手机api
xufenglei
2017-10-27 750c35d5f61c677f3d77acd5ec4d76d0193c2643
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
129
130
131
<?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.moral.monitor.dao.ScreenApiDao">
 
        <!--设备状态之总数量-->
        <select id="equstatus_total" resultType="int">
            select COUNT(id) from equipment
            <where>
                <if test="area!=''">
                    and area=#{area}
                </if>
            </where>
        </select>
 
 
       <!--设备状态之在线数量-->
       <select id="equstatus_online" resultType="int">
            select COUNT(id) from equipment
            <where>
                <if test="area!=''">
                  and  area=#{area}
                </if>
                <if test="true">
                  and  state=4
                </if>
            </where>
        </select>
 
        <!--设备状态之报警数量-->
        <select id="equstatus_warn" resultType="int">
            select COUNT(id) from equipment
            <where>
                <if test="area!=''">
                    and  area=#{area}
                </if>
                <if test="true">
                    and ( state=1  OR state=2 OR state=3 )
                </if>
            </where>
        </select>
 
 
        <!--设备状态之离线数量-->
         <select id="equstatus_offline" resultType="int">
            select COUNT(id) from equipment
            <where>
                <if test="area!=''">
                    and  area=#{area}
                </if>
               <if test="true">
                    and  state=0
               </if>
            </where>
          </select>
 
 
 
        <!--所有/区域设备列表,总数,在线,离线,报警-->
          <select id="equlist" resultType="com.moral.monitor.entity.Equipment">
        select  *  from equipment
        <where>
            <if test="area!=''">
                and  area=#{area}
            </if>
 
            <if test="status=='在线'">
                and  state=4
            </if>
 
            <if test="status=='离线'">
                and  state=0
            </if>
 
            <if test="status=='报警'">
                and ( state=1  OR state=2 OR state=3 )
            </if>
 
        </where>
        LIMIT #{index},#{size}
    </select>
 
        <!--分页数计算-->
    <select id="equlist_size" resultType="int">
        select  count(id)  from equipment
        <where>
            <if test="area!=''">
                and  area=#{area}
            </if>
 
            <if test="status=='在线'">
                and  state=4
            </if>
 
            <if test="status=='离线'">
                and  state=0
            </if>
 
            <if test="status=='报警'">
                and ( state=1  OR state=2 OR state=3 )
            </if>
 
        </where>
 
    </select>
 
 
 
 
 
    <!-- 按名称查找设备 -->
    <select id="equinfo" resultType="com.moral.monitor.entity.Equipment">
        select *  from equipment WHERE name LIKE '%${name}%'   LIMIT #{index},#{size}
    </select>
 
    <!--分页数计算-->
    <select id="equinfo_size" resultType="int">
        select count(id) from equipment WHERE name LIKE '%${name}%'
    </select>
 
 
 
    <!--设备传感器即时数据-->
    <select id="equsensorstate"  parameterType="String" resultType="com.moral.monitor.entity.State">
        select  * from state WHERE mac=#{mac}
    </select>
 
 
 
</mapper>