|
@@ -1162,19 +1162,19 @@
|
|
|
ROUND(sum(if(alarmNumber > 0 ,0,1))/if(count(1) != 0, count(1),1) * 100,2) as "normalRate"
|
|
|
from (
|
|
|
select
|
|
|
- s.SCENE_NAME as "sceneName",count(ad.id) as "alarmNumber"
|
|
|
- from sms_scene_type st
|
|
|
+ s.SCENE_NAME as "sceneName"
|
|
|
+ <if test="parmType != null and parmType == -1">
|
|
|
+ ,sum( if(dp.PARM_TYPE IN ( 15, 8, 10, 11, 18, 19 ) and ad.id is not null,1,0) ) AS "alarmNumber"
|
|
|
+ </if>
|
|
|
+ <if test="parmType != null and parmType != -1">
|
|
|
+ ,sum( if(dp.PARM_TYPE = #{parmType} and ad.id is not null,1,0) ) AS "alarmNumber"
|
|
|
+ </if>
|
|
|
+ from sms_scene_type st
|
|
|
left join sms_scene s on s.SCENE_TYPE_ID =st.id and PARENT_SCENE_ID ='0'
|
|
|
left join sms_device_parm dp on dp.PARENT_SCENE_ID =s.ID
|
|
|
- <if test="parmType != null and parmType == -1">
|
|
|
- and dp.PARM_TYPE in (15,8,10,11,18,19)
|
|
|
- </if>
|
|
|
- <if test="parmType != null and parmType != -1">
|
|
|
- and dp.PARM_TYPE = #{parmType}
|
|
|
- </if>
|
|
|
left join sms_alarm_details ad on ad.STATE = 1 and ad.SCENE_ID=dp.SCENE_ID and ad.DEVICE_ID =dp.DEVICE_ID and ad.ATTRIBUTE_ID =dp.ATTRIBUTE_ID
|
|
|
|
|
|
- where s.`STATUS`=1 and s.ENABLE_STATE = 1 and st.SCENE_TYPE_NAME = '水厂' and s.TENANT_ID =#{tenantId}
|
|
|
+ where s.`STATUS`=1 and s.ENABLE_STATE = 1 and st.SCENE_TYPE_NAME = '水厂' and s.TENANT_ID =#{tenantId} and dp.`STATUS` = 1
|
|
|
|
|
|
<if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
<if test="permissonType == 5 or permissonType == 2">
|
|
@@ -1203,7 +1203,6 @@
|
|
|
and (s.DEPT_ORG_ID is null or s.DEPT_ORG_ID =0)
|
|
|
</if>
|
|
|
</if>
|
|
|
-
|
|
|
group by s.SCENE_NAME
|
|
|
) a
|
|
|
|