|
@@ -430,8 +430,8 @@
|
|
|
</select>
|
|
|
<!--报警场景及报警设备查询-->
|
|
|
<select id="selectAlarmSceneAndDevice" resultType="map">
|
|
|
- select amount, id, name, type from(
|
|
|
- select count(1) amount, a.id, a.SCENE_NAME name,2 type
|
|
|
+ select amount, id, name, sort from(
|
|
|
+ select count(1) amount, a.id, a.SCENE_NAME name,2 sort
|
|
|
from sms_scene a INNER JOIN sms_scene_type b on a.SCENE_TYPE_ID=b.ID
|
|
|
INNER JOIN sms_alarm_details c on c.PARENT_SCENE_ID=a.ID
|
|
|
<where>
|
|
@@ -470,11 +470,11 @@
|
|
|
and c.date_create < date_format(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
and SCENE_TYPE_NAME in('水源','水厂','泵站')
|
|
|
</where>
|
|
|
- group by a.SCENE_NAME, a.ID, type
|
|
|
+ group by a.SCENE_NAME, a.ID, sort
|
|
|
|
|
|
union all
|
|
|
|
|
|
- select count(1) amount, d.id, d.DEVICE_NAME name,1 type
|
|
|
+ select count(1) amount, d.id, d.DEVICE_NAME name,1 sort
|
|
|
from sms_alarm_details c
|
|
|
INNER JOIN sms_device d on c.DEVICE_ID=d.ID
|
|
|
INNER JOIN sms_scene a on c.PARENT_SCENE_ID=a.ID
|
|
@@ -515,7 +515,39 @@
|
|
|
and c.date_create < date_format(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
and SCENE_TYPE_NAME='管网'
|
|
|
</where>
|
|
|
- group by d.DEVICE_NAME, d.ID, type) t
|
|
|
+ group by d.DEVICE_NAME, d.ID, sort) t
|
|
|
order by amount desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectMonthAlarmTimes" resultType="map">
|
|
|
+ select count(1) 数量, DATE_FORMAT(c.DATE_CREATE,'%Y-%m-%d') 日期
|
|
|
+ <if test="sort == 2">
|
|
|
+ from sms_scene a INNER JOIN sms_scene_type b on a.SCENE_TYPE_ID=b.ID
|
|
|
+ INNER JOIN sms_alarm_details c on c.PARENT_SCENE_ID=a.ID
|
|
|
+ where a.ID = #{scene.id}
|
|
|
+ </if>
|
|
|
+ <if test="sort == 1">
|
|
|
+ from sms_alarm_details c
|
|
|
+ where c.device_id = #{scene.id}
|
|
|
+ </if>
|
|
|
+ and c.date_create >= date_format(#{startDate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
+ and c.date_create < date_format(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
+ group by DATE_FORMAT(c.DATE_CREATE,'%Y-%m-%d')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectYearAlarmTimes" resultType="map">
|
|
|
+ select count(1) 数量, DATE_FORMAT(c.DATE_CREATE,'%Y-%m') 日期
|
|
|
+ <if test="sort == 2">
|
|
|
+ from sms_scene a INNER JOIN sms_scene_type b on a.SCENE_TYPE_ID=b.ID
|
|
|
+ INNER JOIN sms_alarm_details c on c.PARENT_SCENE_ID=a.ID
|
|
|
+ where a.ID = #{scene.id}
|
|
|
+ </if>
|
|
|
+ <if test="sort == 1">
|
|
|
+ from sms_alarm_details c
|
|
|
+ where c.device_id = #{scene.id}
|
|
|
+ </if>
|
|
|
+ and c.date_create >= date_format(#{startDate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
+ and c.date_create < date_format(#{endDate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
+ group by DATE_FORMAT(c.DATE_CREATE,'%Y-%m')
|
|
|
+ </select>
|
|
|
</mapper>
|