|
@@ -292,6 +292,7 @@
|
|
|
SELECT
|
|
SELECT
|
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building where 1 = 1 <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building where 1 = 1 <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
|
SUM(read_times) as read_times,
|
|
SUM(read_times) as read_times,
|
|
|
SUM(real_read_times) as real_read_times,
|
|
SUM(real_read_times) as real_read_times,
|
|
@@ -303,6 +304,7 @@
|
|
|
AND b.`status` = 1
|
|
AND b.`status` = 1
|
|
|
<if test="siteId != null"> and a.site_id = #{siteId} </if>
|
|
<if test="siteId != null"> and a.site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and a.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and a.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and a.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!--按表类型查询7天内的抄表率数据统计-->
|
|
<!--按表类型查询7天内的抄表率数据统计-->
|
|
@@ -310,6 +312,7 @@
|
|
|
SELECT
|
|
SELECT
|
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building_7day where 1 = 1 <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building_7day where 1 = 1 <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
|
SUM(read_times) as read_times,
|
|
SUM(read_times) as read_times,
|
|
|
SUM(real_read_times) as real_read_times,
|
|
SUM(real_read_times) as real_read_times,
|
|
@@ -321,6 +324,7 @@
|
|
|
AND b.`status` = 1
|
|
AND b.`status` = 1
|
|
|
<if test="siteId != null"> and a.site_id = #{siteId} </if>
|
|
<if test="siteId != null"> and a.site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and a.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and a.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and a.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -329,6 +333,7 @@
|
|
|
SELECT
|
|
SELECT
|
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building_15day where 1 = 1 <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building_15day where 1 = 1 <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
|
SUM(read_times) as read_times,
|
|
SUM(read_times) as read_times,
|
|
|
SUM(real_read_times) as real_read_times,
|
|
SUM(real_read_times) as real_read_times,
|
|
@@ -340,15 +345,18 @@
|
|
|
AND b.`status` = 1
|
|
AND b.`status` = 1
|
|
|
<if test="siteId != null"> and a.site_id = #{siteId} </if>
|
|
<if test="siteId != null"> and a.site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and a.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and a.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and a.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!--查询时间范围内根据表类型的抄表率数据统计-->
|
|
<!--查询时间范围内根据表类型的抄表率数据统计-->
|
|
|
<select id="getRateListByType" resultType="com.bz.smart_city.dto.WaterReadRateListDto">
|
|
<select id="getRateListByType" resultType="com.bz.smart_city.dto.WaterReadRateListDto">
|
|
|
|
|
+ select * from (
|
|
|
SELECT
|
|
SELECT
|
|
|
swmt.channel_id,
|
|
swmt.channel_id,
|
|
|
sdt.equipment_type as device_type_name,
|
|
sdt.equipment_type as device_type_name,
|
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building where channel_id = swmt.channel_id <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
(select SUM(device_count) from sc_stat_meter_read_rate_by_building where channel_id = swmt.channel_id <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
|
SUM(ssmrrbb.read_times) as read_times,
|
|
SUM(ssmrrbb.read_times) as read_times,
|
|
|
SUM(ssmrrbb.real_read_times) as real_read_times,
|
|
SUM(ssmrrbb.real_read_times) as real_read_times,
|
|
@@ -359,6 +367,7 @@
|
|
|
ssmrrbb.channel_id = swmt.channel_id <if test="siteId != null"> and ssmrrbb.site_id = #{siteId} </if>
|
|
ssmrrbb.channel_id = swmt.channel_id <if test="siteId != null"> and ssmrrbb.site_id = #{siteId} </if>
|
|
|
and ssmrrbb.stat_day = #{startDate}
|
|
and ssmrrbb.stat_day = #{startDate}
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and ssmrrbb.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and ssmrrbb.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and ssmrrbb.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
)
|
|
)
|
|
|
left join sc_device_type sdt on (sdt.id = swmt.device_type_id)
|
|
left join sc_device_type sdt on (sdt.id = swmt.device_type_id)
|
|
|
WHERE swmt.`level` = 2
|
|
WHERE swmt.`level` = 2
|
|
@@ -368,15 +377,21 @@
|
|
|
order by ${sortColumn} ${sortOrder}
|
|
order by ${sortColumn} ${sortOrder}
|
|
|
</if>
|
|
</if>
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ ) t1
|
|
|
|
|
+ where t1.device_count is not null
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!--查询7天内根据表类型的抄表率数据统计-->
|
|
<!--查询7天内根据表类型的抄表率数据统计-->
|
|
|
<select id="getRateList7DayByType" resultType="com.bz.smart_city.dto.WaterReadRateListDto">
|
|
<select id="getRateList7DayByType" resultType="com.bz.smart_city.dto.WaterReadRateListDto">
|
|
|
- SELECT
|
|
|
|
|
- swmt.channel_id,
|
|
|
|
|
- sdt.equipment_type as device_type_name,
|
|
|
|
|
- (select SUM(device_count) from sc_stat_meter_read_rate_by_building_7day where channel_id = swmt.channel_id <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
|
|
|
|
+ <if test="siteId != null">select * from (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ swmt.channel_id,
|
|
|
|
|
+ sdt.equipment_type as device_type_name,
|
|
|
|
|
+ (select SUM(device_count) from sc_stat_meter_read_rate_by_building_7day where channel_id =
|
|
|
|
|
+ swmt.channel_idand site_id = #{siteId}
|
|
|
|
|
+ </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
|
SUM(ssmrrbb.read_times) as read_times,
|
|
SUM(ssmrrbb.read_times) as read_times,
|
|
|
SUM(ssmrrbb.real_read_times) as real_read_times,
|
|
SUM(ssmrrbb.real_read_times) as real_read_times,
|
|
@@ -387,6 +402,7 @@
|
|
|
ssmrrbb.channel_id = swmt.channel_id <if test="siteId != null"> and ssmrrbb.site_id = #{siteId} </if>
|
|
ssmrrbb.channel_id = swmt.channel_id <if test="siteId != null"> and ssmrrbb.site_id = #{siteId} </if>
|
|
|
and ssmrrbb.stat_day = #{startDate}
|
|
and ssmrrbb.stat_day = #{startDate}
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and ssmrrbb.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and ssmrrbb.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and ssmrrbb.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
)
|
|
)
|
|
|
left join sc_device_type sdt on (sdt.id = swmt.device_type_id)
|
|
left join sc_device_type sdt on (sdt.id = swmt.device_type_id)
|
|
|
WHERE swmt.`level` = 2
|
|
WHERE swmt.`level` = 2
|
|
@@ -396,16 +412,21 @@
|
|
|
order by ${sortColumn} ${sortOrder}
|
|
order by ${sortColumn} ${sortOrder}
|
|
|
</if>
|
|
</if>
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ ) t1 where t1.device_count is not null
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--查询15天内根据表类型的抄表率数据统计-->
|
|
<!--查询15天内根据表类型的抄表率数据统计-->
|
|
|
<select id="getRateList15DayByType" resultType="com.bz.smart_city.dto.WaterReadRateListDto">
|
|
<select id="getRateList15DayByType" resultType="com.bz.smart_city.dto.WaterReadRateListDto">
|
|
|
- SELECT
|
|
|
|
|
- swmt.channel_id,
|
|
|
|
|
- sdt.equipment_type as device_type_name,
|
|
|
|
|
- (select SUM(device_count) from sc_stat_meter_read_rate_by_building_15day where channel_id = swmt.channel_id <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
|
|
|
|
+ <if test="siteId != null">select * from (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ swmt.channel_id,
|
|
|
|
|
+ sdt.equipment_type as device_type_name,
|
|
|
|
|
+ (select SUM(device_count) from sc_stat_meter_read_rate_by_building_15day where channel_id =
|
|
|
|
|
+ swmt.channel_idand site_id = #{siteId}
|
|
|
|
|
+ </if>
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
GROUP BY stat_day desc limit 1) as device_count,
|
|
|
SUM(ssmrrbb.read_times) as read_times,
|
|
SUM(ssmrrbb.read_times) as read_times,
|
|
|
SUM(ssmrrbb.real_read_times) as real_read_times,
|
|
SUM(ssmrrbb.real_read_times) as real_read_times,
|
|
@@ -416,6 +437,7 @@
|
|
|
ssmrrbb.channel_id = swmt.channel_id <if test="siteId != null"> and ssmrrbb.site_id = #{siteId} </if>
|
|
ssmrrbb.channel_id = swmt.channel_id <if test="siteId != null"> and ssmrrbb.site_id = #{siteId} </if>
|
|
|
and ssmrrbb.stat_day = #{startDate}
|
|
and ssmrrbb.stat_day = #{startDate}
|
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and ssmrrbb.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
<if test="buildingIds != null and buildingIds.size() != 0"> and ssmrrbb.building_id in <foreach collection="buildingIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
|
|
+ <if test="customerIds != null and customerIds.size() != 0"> and ssmrrbb.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach> </if>
|
|
|
)
|
|
)
|
|
|
left join sc_device_type sdt on (sdt.id = swmt.device_type_id)
|
|
left join sc_device_type sdt on (sdt.id = swmt.device_type_id)
|
|
|
WHERE swmt.`level` = 2
|
|
WHERE swmt.`level` = 2
|
|
@@ -425,6 +447,7 @@
|
|
|
order by ${sortColumn} ${sortOrder}
|
|
order by ${sortColumn} ${sortOrder}
|
|
|
</if>
|
|
</if>
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ ) t1 where t1.device_count is not null
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<!--查询最近7天抄表率-->
|
|
<!--查询最近7天抄表率-->
|