|
@@ -3,25 +3,6 @@
|
|
|
<mapper namespace="com.huaxu.dao.OnlineMonitorMapper">
|
|
|
<!-- 结果集 -->
|
|
|
<resultMap type="com.huaxu.dto.MonitorDataCollectDto" id="monitorDataMap">
|
|
|
- <result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
|
- <result property="sceneName" column="scene_name" jdbcType="VARCHAR"/>
|
|
|
- <result property="sceneTypeName" column="scene_type_name" jdbcType="VARCHAR"/>
|
|
|
- <result property="pointX" column="point_x" jdbcType="VARCHAR"/>
|
|
|
- <result property="pointY" column="point_y" jdbcType="VARCHAR"/>
|
|
|
- <result property="address" column="address" jdbcType="VARCHAR"/>
|
|
|
- <result property="sceneState" column="scene_state" jdbcType="INTEGER"/>
|
|
|
- <collection property="MonitorDataEntities" ofType="com.huaxu.dto.MonitorDataDto" javaType="list">
|
|
|
- <result property="deviceId" column="device_id" jdbcType="INTEGER"/>
|
|
|
- <result property="attributeId" column="attribute_id" jdbcType="INTEGER"/>
|
|
|
- <result property="attributeName" column="attribute_name" jdbcType="VARCHAR"/>
|
|
|
- <result property="unit" column="unit" jdbcType="VARCHAR"/>
|
|
|
- <result property="isAlarm" column="is_Alarm" jdbcType="VARCHAR"/>
|
|
|
- <result property="attributeType" column="attribute_type" jdbcType="VARCHAR"/>
|
|
|
- <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
|
|
|
- <result property="latestValue" column="latest_value" jdbcType="VARCHAR"/>
|
|
|
- </collection>
|
|
|
- </resultMap>
|
|
|
- <resultMap type="com.huaxu.dto.MonitorDataCollectDto" id="monitorDataMap2">
|
|
|
<result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
|
<result property="sceneName" column="scene_name" jdbcType="VARCHAR"/>
|
|
|
<result property="sceneTypeName" column="scene_type_name" jdbcType="VARCHAR"/>
|
|
@@ -39,6 +20,7 @@
|
|
|
<result property="attributeType" column="attribute_type" jdbcType="VARCHAR"/>
|
|
|
<result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
|
|
|
<result property="latestValue" column="latest_value" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmRange" column="alarm_range" jdbcType="VARCHAR"/>
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
<!-- 设备结果集 -->
|
|
@@ -60,6 +42,7 @@
|
|
|
<result property="isAlarm" column="is_Alarm" jdbcType="VARCHAR"/>
|
|
|
<result property="attributeType" column="attribute_type" jdbcType="VARCHAR"/>
|
|
|
<result property="latestValue" column="latest_value" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmRange" column="alarm_range" jdbcType="VARCHAR"/>
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
<!-- 管网图层设备结果集 -->
|
|
@@ -80,6 +63,7 @@
|
|
|
<result property="attributeName" column="attribute_name" jdbcType="VARCHAR"/>
|
|
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
|
|
<result property="isAlarm" column="is_Alarm" jdbcType="VARCHAR"/>
|
|
|
+ <result property="alarmRange" column="alarm_range" jdbcType="VARCHAR"/>
|
|
|
</collection>
|
|
|
</collection>
|
|
|
</resultMap>
|
|
@@ -97,7 +81,8 @@
|
|
|
t9.unit ,
|
|
|
case when t5.attribute_id is null then null when t6.id is null then 0 else 1 end is_alarm,
|
|
|
t5.parm_type attribute_type,
|
|
|
- if (t5.device_id is null, null, t4.device_code) device_code
|
|
|
+ if (t5.device_id is null, null, t4.device_code) device_code,
|
|
|
+ concat(t11.alarm_condition,cast(t11.alarm_value as char)+0) alarm_range
|
|
|
</sql>
|
|
|
|
|
|
<sql id="sceneDeviceJoins">
|
|
@@ -114,6 +99,7 @@
|
|
|
left join sms_device_attribute t9 on t5.attribute_id=t9.id and t9.status = 1
|
|
|
left join sms_alarm_details t6 on t6.scene_id=t2.scene_id and t6.device_id=t2.device_id
|
|
|
and t6.attribute_id=t5.attribute_id and t6.status = 1 and t6.state=1
|
|
|
+ left join sms_alarm_setting t11 on t6.alarm_setting_id=t11.id and t11.status = 1 and t11.alarm_condition!='='
|
|
|
</sql>
|
|
|
|
|
|
<sql id="sceneAlarmJoins">
|
|
@@ -223,7 +209,7 @@
|
|
|
order by alalmCount desc
|
|
|
</select>
|
|
|
<!--查询地图悬浮数据-->
|
|
|
- <select id="selectMapSuspension" resultMap="monitorDataMap2">
|
|
|
+ <select id="selectMapSuspension" resultMap="monitorDataMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
|
<if test="flag == null or flag ==0">
|
|
@@ -365,7 +351,7 @@
|
|
|
and t5.parm_type in(3,4,5,6)
|
|
|
</if>
|
|
|
<if test="type == 2 ">
|
|
|
- and t5.parm_type in(2,3,4,5,6,7,8,9,10,11,12,13,14)
|
|
|
+ and t5.parm_type in(2,3,4,5,6,7,8,9,10,11,12,13,14,20)
|
|
|
</if>
|
|
|
<if test="type == 5 ">
|
|
|
and t5.parm_type in(3,4,12,13,14)
|
|
@@ -455,7 +441,7 @@
|
|
|
<!--查询设备地图参数数据-->
|
|
|
<select id="selectDeviceMapParam" resultMap="deviceDataMap">
|
|
|
select distinct t1.id device_id,t1.device_code,t1.device_name,t1.point_x,point_y,t1.address,t2.attribute_id, ifnull(t2.remark, t3.`name`) attribute_name,t3.unit,
|
|
|
- t2.seq,case when t2.attribute_id is null then null when t6.id is null then 0 else 1 end is_alarm
|
|
|
+ t2.seq,case when t2.attribute_id is null then null when t6.id is null then 0 else 1 end is_alarm,concat(t11.alarm_condition,cast(t11.alarm_value as char)+0) alarm_range
|
|
|
<if test="flag == null or flag ==0">
|
|
|
,if (t4.alarm_count>0, 1, 0) device_state
|
|
|
</if>
|
|
@@ -477,6 +463,7 @@
|
|
|
from sms_alarm_details a1 where a1.device_id= #{deviceId} and a1.`status` = 1 and a1.state = 1
|
|
|
)t4 on t4.device_id=t1.id
|
|
|
left join sms_alarm_details t6 on t6.device_id=t1.id and t6.attribute_id=t2.attribute_id and t6.status = 1 and t6.state=1
|
|
|
+ left join sms_alarm_setting t11 on t6.alarm_setting_id=t11.id and t11.status = 1 and t11.alarm_condition!='='
|
|
|
where t1. status = 1 and t1. enable_state = 1 and t1.id= #{deviceId}
|
|
|
order by t2.seq
|
|
|
</select>
|
|
@@ -647,8 +634,8 @@
|
|
|
</select>
|
|
|
<!--查询管网地图图层及设备-->
|
|
|
<select id="selectPipeNetLayer" resultMap="layerMap">
|
|
|
- select t4.id scene_id,t4.scene_name,t5.scene_type_name,t6.id device_id,t6.device_code,t6.device_name,t6.point_x,t6.point_y,t6.address
|
|
|
- ,t8.attribute_id ,ifnull(t8.remark, t9.`name`) attribute_name,t9.unit,case when t8.attribute_id is null then null when t10.id is null then 0 else 1 end is_alarm
|
|
|
+ select t4.id scene_id,t4.scene_name,t5.scene_type_name,t6.id device_id,t6.device_code,t6.device_name,t6.point_x,t6.point_y,t6.address,concat(t11.alarm_condition,cast(t11.alarm_value as char)+0) alarm_range
|
|
|
+ ,t8.attribute_id ,ifnull(t8.remark, t9.`name`) attribute_name,t9.unit,case when t8.attribute_id is null then null when t10.id is null then 0 else 1 end is_alarm
|
|
|
<if test="flag == null or flag ==0">
|
|
|
,if (t7.alarm_count>0, 1, 0) device_state
|
|
|
</if>
|
|
@@ -671,6 +658,7 @@
|
|
|
left join sms_device_parm t8 on t8.scene_id = t2.scene_id and t8.device_id=t2.device_id and t8. status = 1 and t8.is_suspension = 1
|
|
|
left join sms_device_attribute t9 on t8.attribute_id=t9.id and t9.status = 1
|
|
|
left join sms_alarm_details t10 on t10.scene_id=t2.scene_id and t10.device_id=t2.device_id and t10.attribute_id=t8.attribute_id and t10.status = 1 and t10.state=1
|
|
|
+ left join sms_alarm_setting t11 on t10.alarm_setting_id=t11.id and t11.status = 1 and t11.alarm_condition!='='
|
|
|
where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t3.scene_type_name = '管网'
|
|
|
<choose>
|
|
|
<when test="sceneTypeName != null and sceneTypeName !=''">
|
|
@@ -828,4 +816,29 @@
|
|
|
</if>
|
|
|
order by t4.scene_name,t8.seq
|
|
|
</select>
|
|
|
+ <!--查询场景实时状态数量-->
|
|
|
+ <select id="selectStateCount" resultType="java.util.Map">
|
|
|
+ select sceneState,count(1) sceneCount
|
|
|
+ from(
|
|
|
+ select case when t7.offline_alarm_count=t10.setting_device_count then 2
|
|
|
+ when t7.alarm_count>0 or t7.offline_alarm_count>0 then 1 else 0 end sceneState
|
|
|
+ from sms_scene t1
|
|
|
+ inner join sms_scene_type t3 on t3.id = t1.scene_type_id and t3. status = 1
|
|
|
+ <include refid="sceneAlarmJoins"/>
|
|
|
+ where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1
|
|
|
+ <if test="sceneTypeName != null and sceneTypeName != ''">
|
|
|
+ and t3.scene_type_name = #{sceneTypeName}
|
|
|
+ </if>
|
|
|
+ <if test="sceneIds != null and sceneIds.size() > 0">
|
|
|
+ and t1.id in
|
|
|
+ <foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="sceneIds == null or sceneIds.size() == 0">
|
|
|
+ and t1.id is null
|
|
|
+ </if>
|
|
|
+ )tab1
|
|
|
+ group by sceneState
|
|
|
+ </select>
|
|
|
</mapper>
|