|
@@ -88,7 +88,7 @@
|
|
|
<sql id="sceneDeviceJoins">
|
|
|
inner join sms_scene_type t3 on t3.id = t1.scene_type_id and t3. status = 1
|
|
|
left join sms_device_scene t2 on t2.parent_scene_id=t1.id and t2. status = 1
|
|
|
- left join sms_device t4 on t2.device_id=t4.id and t4. status = 1 and t4. enable_state = 1
|
|
|
+ left join sms_device t4 on t2.device_id=t4.id and t4. status = 1
|
|
|
left join sms_device_parm t5 on t5.scene_id = t2.scene_id and t5.device_id=t2.device_id and t5. status = 1
|
|
|
<if test="type == 3 ">
|
|
|
and t5.is_suspension = 1
|
|
@@ -135,7 +135,7 @@
|
|
|
<sql id="deviceInnerJoins">
|
|
|
inner join sms_scene_type t3 on t1.scene_type_id=t3.id and t3. status = 1
|
|
|
inner join sms_device_scene t2 on t2.parent_scene_id=t1.id and t2. status = 1
|
|
|
- inner join sms_device t6 on t2.device_id=t6.id and t6. status = 1 and t6.enable_state = 1
|
|
|
+ inner join sms_device t6 on t2.device_id=t6.id and t6. status = 1
|
|
|
inner join sms_scene t4 on t2.scene_id=t4.id and t4. status = 1
|
|
|
inner join sms_scene_type t5 on t4.scene_type_id=t5.id and t5. status = 1
|
|
|
</sql>
|
|
@@ -143,7 +143,7 @@
|
|
|
<sql id="deviceLeftJoins">
|
|
|
inner join sms_scene_type t3 on t1.scene_type_id=t3.id and t3. status = 1
|
|
|
left join sms_device_scene t2 on t2.parent_scene_id=t1.id and t2. status = 1
|
|
|
- left join sms_device t6 on t2.device_id=t6.id and t6. status = 1 and t6.enable_state = 1
|
|
|
+ left join sms_device t6 on t2.device_id=t6.id and t6. status = 1
|
|
|
left join sms_scene t4 on t2.scene_id=t4.id and t4. status = 1
|
|
|
left join sms_scene_type t5 on t4.scene_type_id=t5.id and t5. status = 1 and t5.scene_type_name = #{sceneTypeName}
|
|
|
</sql>
|
|
@@ -318,7 +318,7 @@
|
|
|
from sms_scene t1
|
|
|
inner join sms_scene_type t3 on t3.id = t1.scene_type_id and t3. status = 1
|
|
|
inner join sms_alarm_details t6 on t1.id=t6.parent_scene_id and t6.`status`=1
|
|
|
- inner join sms_device t4 on t4.id=t6.device_id and t4.`status`=1 and t4. enable_state = 1
|
|
|
+ inner join sms_device t4 on t4.id=t6.device_id and t4.`status`=1
|
|
|
where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t1.id = #{id}
|
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
|
and t1.id in
|
|
@@ -607,15 +607,16 @@
|
|
|
and t6.device_name like concat('%', #{deviceName},'%')
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
<!--分页查询管网实时数据列表-->
|
|
|
<select id="selectPipeNetPage" resultType="com.bz.zoneiot.water.api.vo.OnlineDataVo">
|
|
|
- select t1.id scene_id,t1.scene_name,t6.id device_id,t6.device_code,t6.device_name,t6.address,if (t7.alarm_count>0, 1, 0) deviceState
|
|
|
+ select t1.id scene_id,t1.scene_name,t6.id device_id,t6.device_code,t6.device_name,t6.address,t6.ENABLE_STATE deviceState
|
|
|
from sms_scene t1
|
|
|
<include refid="deviceInnerJoins"/>
|
|
|
- left join(
|
|
|
- select a1.scene_id, a1.device_id ,count(1) alarm_count from sms_alarm_details a1 where a1.`status` = 1 and a1.state = 1 group by a1.scene_id, a1.device_id
|
|
|
- )t7 on t7.scene_id=t2.scene_id and t7.device_id=t2.device_id
|
|
|
- where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t3.scene_type_name = '管网' and t5.scene_type_name = #{onlineDataDto.sceneTypeName}
|
|
|
+ where
|
|
|
+ t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t3.scene_type_name = '管网'
|
|
|
+ and t5.scene_type_name = #{onlineDataDto.sceneTypeName}
|
|
|
<if test="onlineDataDto.sceneIds != null and onlineDataDto.sceneIds.size() > 0">
|
|
|
and t1.id in
|
|
|
<foreach collection="onlineDataDto.sceneIds" item="item" open="(" close=")" separator=",">
|
|
@@ -852,7 +853,7 @@
|
|
|
from sms_scene t1
|
|
|
inner join sms_scene_type t3 on t3.id = t1.scene_type_id and t3. status = 1
|
|
|
inner join sms_alarm_details t6 on t1.id=t6.parent_scene_id and t6.`status`=1
|
|
|
- inner join sms_device t4 on t4.id=t6.device_id and t4.`status`=1 and t4. enable_state = 1
|
|
|
+ inner join sms_device t4 on t4.id=t6.device_id and t4.`status`=1
|
|
|
where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t1.id = #{id}
|
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
|
and t1.id in
|