|
@@ -333,8 +333,8 @@
|
|
|
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, if (t4.alarm_count>0, 1, 0) device_state
|
|
|
from sms_device t1
|
|
|
- left join sms_device_parm t2 on t2.device_id=t1.id and t2.is_map=1
|
|
|
- left join sms_device_attribute t3 on t2.attribute_id=t3.id
|
|
|
+ left join sms_device_parm t2 on t2.device_id=t1.id and t2.is_map=1 and t2.status=1
|
|
|
+ left join sms_device_attribute t3 on t2.attribute_id=t3.id and t3.status=1
|
|
|
left join (
|
|
|
select a1.device_id,count(1) alarm_count 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
|
|
@@ -382,7 +382,7 @@
|
|
|
count(t8.device_id) alarmCount
|
|
|
from sms_scene t1
|
|
|
<include refid="deviceInnerJoins"/>
|
|
|
- inner join sms_device_parm t7 on t7.scene_id=t2.scene_id and t7.device_id=t2.device_id
|
|
|
+ inner join sms_device_parm t7 on t7.scene_id=t2.scene_id and t7.device_id=t2.device_id and t7.status=1
|
|
|
<if test="sceneTypeName == '压力'">
|
|
|
and t7.parm_type in(13)
|
|
|
</if>
|