|
@@ -5,6 +5,7 @@
|
|
<resultMap type="com.huaxu.dto.MonitorDataCollectDto" id="monitorDataMap">
|
|
<resultMap type="com.huaxu.dto.MonitorDataCollectDto" id="monitorDataMap">
|
|
<result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
<result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
<result property="sceneName" column="scene_name" jdbcType="VARCHAR"/>
|
|
<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="pointX" column="point_x" jdbcType="VARCHAR"/>
|
|
<result property="pointY" column="point_y" jdbcType="VARCHAR"/>
|
|
<result property="pointY" column="point_y" jdbcType="VARCHAR"/>
|
|
<result property="address" column="address" jdbcType="VARCHAR"/>
|
|
<result property="address" column="address" jdbcType="VARCHAR"/>
|
|
@@ -44,6 +45,7 @@
|
|
<resultMap type="com.huaxu.dto.PipeNetLayerDto" id="layerMap">
|
|
<resultMap type="com.huaxu.dto.PipeNetLayerDto" id="layerMap">
|
|
<result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
<result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
|
|
<result property="sceneName" column="scene_name" jdbcType="VARCHAR"/>
|
|
<result property="sceneName" column="scene_name" jdbcType="VARCHAR"/>
|
|
|
|
+ <result property="sceneTypeName" column="scene_type_name" jdbcType="VARCHAR"/>
|
|
<collection property="deviceDataList" ofType="com.huaxu.dto.MonitorDataCollectDto" javaType="list">
|
|
<collection property="deviceDataList" ofType="com.huaxu.dto.MonitorDataCollectDto" javaType="list">
|
|
<result property="deviceId" column="device_id" jdbcType="INTEGER"/>
|
|
<result property="deviceId" column="device_id" jdbcType="INTEGER"/>
|
|
<result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
|
|
<result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
|
|
@@ -58,6 +60,7 @@
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
t1.id scene_Id,
|
|
t1.id scene_Id,
|
|
t1.scene_name ,
|
|
t1.scene_name ,
|
|
|
|
+ t3.scene_type_name,
|
|
t1.point_x ,
|
|
t1.point_x ,
|
|
t1.point_y,
|
|
t1.point_y,
|
|
t1.address ,
|
|
t1.address ,
|
|
@@ -178,7 +181,15 @@
|
|
from sms_scene t1
|
|
from sms_scene t1
|
|
<include refid="sceneDeviceJoins"/>
|
|
<include refid="sceneDeviceJoins"/>
|
|
<include refid="sceneAlarmJoins"/>
|
|
<include refid="sceneAlarmJoins"/>
|
|
- where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t3.scene_type_name = #{sceneTypeName}
|
|
|
|
|
|
+ where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="sceneTypeName != null and sceneTypeName !=''">
|
|
|
|
+ and t3.scene_type_name = #{sceneTypeName}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ and t3.scene_type_name in('水源','水厂','泵站')
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
and t1.id in
|
|
and t1.id in
|
|
<foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
|
|
<foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
|
|
@@ -191,7 +202,7 @@
|
|
<if test="tenantId != null and tenantId != ''">
|
|
<if test="tenantId != null and tenantId != ''">
|
|
and t1.tenant_id = #{tenantId}
|
|
and t1.tenant_id = #{tenantId}
|
|
</if>
|
|
</if>
|
|
- order by t1.scene_name,t5.seq
|
|
|
|
|
|
+ order by t3.scene_type_name,t1.scene_name,t5.seq
|
|
</select>
|
|
</select>
|
|
<!--查询地图参数数据-->
|
|
<!--查询地图参数数据-->
|
|
<select id="selectMapParam" resultMap="monitorDataMap">
|
|
<select id="selectMapParam" resultMap="monitorDataMap">
|
|
@@ -332,13 +343,21 @@
|
|
</select>
|
|
</select>
|
|
<!--统计设备合格数据-->
|
|
<!--统计设备合格数据-->
|
|
<select id="statsDeviceQualified" resultType="com.huaxu.dto.DeviceCountStatsDto">
|
|
<select id="statsDeviceQualified" resultType="com.huaxu.dto.DeviceCountStatsDto">
|
|
- select count(1) totalCount,sum(if(t7.device_id is null,0,1)) alarmCount,count(1)-sum(if(t7.device_id is null,0,1)) normalCount
|
|
|
|
|
|
+ select t5.scene_type_name type,count(1) totalCount,sum(if(t7.device_id is null,0,1)) alarmCount,count(1)-sum(if(t7.device_id is null,0,1)) normalCount
|
|
from sms_scene t1
|
|
from sms_scene t1
|
|
<include refid="deviceInnerJoins"/>
|
|
<include refid="deviceInnerJoins"/>
|
|
left join(
|
|
left join(
|
|
select a1.scene_id, a1.device_id from sms_alarm_details a1 where a1.`status` = 1 and a1.state = 1 group by a1.scene_id, a1.device_id
|
|
select a1.scene_id, a1.device_id 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
|
|
)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 = #{sceneTypeName}
|
|
|
|
|
|
+ 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 !=''">
|
|
|
|
+ and t5.scene_type_name = #{sceneTypeName}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ and t5.scene_type_name in('压力','流量','水质')
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
and t1.id in
|
|
and t1.id in
|
|
<foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
|
|
<foreach collection="sceneIds" item="item" open="(" close=")" separator=",">
|
|
@@ -354,6 +373,7 @@
|
|
<if test="deviceName != null and deviceName != ''">
|
|
<if test="deviceName != null and deviceName != ''">
|
|
and t6.device_name like concat('%', #{deviceName},'%')
|
|
and t6.device_name like concat('%', #{deviceName},'%')
|
|
</if>
|
|
</if>
|
|
|
|
+ group by t5.scene_type_name
|
|
</select>
|
|
</select>
|
|
<!--统计设备属性合格数据-->
|
|
<!--统计设备属性合格数据-->
|
|
<select id="statsParmQualified" resultType="com.huaxu.dto.DeviceCountStatsDto">
|
|
<select id="statsParmQualified" resultType="com.huaxu.dto.DeviceCountStatsDto">
|
|
@@ -368,7 +388,7 @@
|
|
<if test="sceneTypeName == '水质'">
|
|
<if test="sceneTypeName == '水质'">
|
|
and t7.parm_type in(7,9,11)
|
|
and t7.parm_type in(7,9,11)
|
|
</if>
|
|
</if>
|
|
- inner join sms_alarm_details t8 on t8.attribute_id=t7.attribute_id and t8.device_id=t7.device_id and t8.scene_id=t7.scene_id and t8.`status` = 1 and t8.state = 1
|
|
|
|
|
|
+ left join sms_alarm_details t8 on t8.attribute_id=t7.attribute_id and t8.device_id=t7.device_id and t8.scene_id=t7.scene_id and t8.`status` = 1 and t8.state = 1
|
|
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 = #{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 = #{sceneTypeName}
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
<if test="sceneIds != null and sceneIds.size() > 0">
|
|
and t1.id in
|
|
and t1.id in
|
|
@@ -471,7 +491,7 @@
|
|
</select>
|
|
</select>
|
|
<!--查询管网地图图层及设备-->
|
|
<!--查询管网地图图层及设备-->
|
|
<select id="selectPipeNetLayer" resultMap="layerMap">
|
|
<select id="selectPipeNetLayer" resultMap="layerMap">
|
|
- select t4.id scene_id,t4.scene_name,t6.id device_id,t6.device_code,t6.device_name,t6.point_x,t6.point_y,t6.address,if (t7.alarm_count>0, 1, 0) device_state
|
|
|
|
|
|
+ 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,if (t7.alarm_count>0, 1, 0) device_state
|
|
from sms_scene t1
|
|
from sms_scene t1
|
|
<include refid="deviceInnerJoins"/>
|
|
<include refid="deviceInnerJoins"/>
|
|
left join(
|
|
left join(
|
|
@@ -497,4 +517,22 @@
|
|
</if>
|
|
</if>
|
|
order by t4.scene_name,t6.date_create
|
|
order by t4.scene_name,t6.date_create
|
|
</select>
|
|
</select>
|
|
|
|
+ <!--查询昨日水厂制水总量-->
|
|
|
|
+ <select id="selectTotalYieldWater" resultType="java.lang.Double">
|
|
|
|
+ select sum(sum_value) yieldWater
|
|
|
|
+ from sms_scene t1
|
|
|
|
+ <include refid="sceneDeviceJoins"/>
|
|
|
|
+ inner join sms_month_report t8 on t8.device_id=t2.device_id and t8.attribute_id =t5.attribute_id
|
|
|
|
+ and t8.year = year(now() + interval-1 day) and t8.month = month(now() + interval-1 day) and t8.day = day(now() + interval-1 day)
|
|
|
|
+ where t1.parent_scene_id = 0 and t1. status = 1 and t5.parm_type in(3) and t3.scene_type_name = '水厂'
|
|
|
|
+ <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="tenantId != null and tenantId != ''">
|
|
|
|
+ and t1.tenant_id = #{tenantId}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|