<?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>
|