|
@@ -977,24 +977,80 @@
|
|
|
tmp.device_id
|
|
|
FROM
|
|
|
(
|
|
|
- SELECT
|
|
|
- site_id,
|
|
|
- sys_id,
|
|
|
- building_id,
|
|
|
- device_id
|
|
|
- FROM
|
|
|
- sc_meter_read_record
|
|
|
- WHERE
|
|
|
- <if test = "param.statDay != null and param.statDay != 0">
|
|
|
- read_date = #{param.statDay}
|
|
|
- </if>
|
|
|
- <if test = "param.buildingId != null and param.buildingId != 0">
|
|
|
- AND building_id = #{param.buildingId}
|
|
|
- </if>
|
|
|
- AND read_status = 1
|
|
|
+ SELECT
|
|
|
+ site_id,
|
|
|
+ channel_id,
|
|
|
+ building_id,
|
|
|
+ device_id
|
|
|
+ FROM
|
|
|
+ sc_stat_meter_unread_device_by_building
|
|
|
+ WHERE
|
|
|
+ <if test = "param.statDay != null and param.statDay != 0">
|
|
|
+ stat_day = #{param.statDay}
|
|
|
+ </if>
|
|
|
+ <if test = "param.buildingId != null and param.buildingId != 0">
|
|
|
+ AND building_id = #{param.buildingId}
|
|
|
+ </if>
|
|
|
) tmp
|
|
|
)
|
|
|
</select>
|
|
|
+ <select id="queryUnReadDeviceListV2" resultType="com.bz.smart_city.dto.DeviceDto">
|
|
|
+ SELECT
|
|
|
+ d.site_id as siteId,
|
|
|
+ d.customer_id as customerId,
|
|
|
+ d.sys_id as sysId,
|
|
|
+ d.id as id,
|
|
|
+ d.device_type as deviceType,
|
|
|
+ d.building_id as buildingId,
|
|
|
+ co.id as community,
|
|
|
+ p.id as province,
|
|
|
+ c.id as city,
|
|
|
+ r.id as region,
|
|
|
+ cu.customer_name as customerName,
|
|
|
+ b.`name`as buildingName,
|
|
|
+ co.`name`as communityName,
|
|
|
+ col.collector_no as collectorName,
|
|
|
+ con.serial_number as concentratorName,
|
|
|
+ d.water_meter_no as waterMeterNo,
|
|
|
+ d.water_meter_file_no as waterMeterFileNo,
|
|
|
+ d.device_no as deviceNo,
|
|
|
+ d.device_status as deviceStatus,
|
|
|
+ d.floor as floor,
|
|
|
+ d.loc_desc as locDesc,
|
|
|
+ d.last_receive_time as lastReceiveTime
|
|
|
+ FROM ${tableName} as t1
|
|
|
+ LEFT JOIN sc_device d on(t1.device_id = d.id)
|
|
|
+ LEFT JOIN sc_w_meter_type wmt ON ( d.device_type = wmt.device_type_id AND wmt.`status` = 1 )
|
|
|
+ LEFT JOIN sc_customer cu ON ( d.customer_id = cu.id AND cu.`status` = 1 )
|
|
|
+ LEFT JOIN sc_building b ON ( d.building_id = b.id AND b.`status` = 1 )
|
|
|
+ LEFT JOIN sc_community co ON ( b.community = co.id AND co.`status` = 1 )
|
|
|
+ LEFT JOIN sc_area p ON ( b.province = p.id )
|
|
|
+ LEFT JOIN sc_area c ON ( b.city = c.id )
|
|
|
+ LEFT JOIN sc_area r ON ( b.region = r.id )
|
|
|
+ LEFT JOIN sc_water_related_device rd ON ( rd.device_id = d.id AND rd.`status` = 1 )
|
|
|
+ LEFT JOIN sc_collector col ON ( col.id = rd.collector_id AND col.`status` = 1 )
|
|
|
+ LEFT JOIN sc_concentrator con ON ( con.id = rd.concentrator_id AND con.`status` = 1 )
|
|
|
+ where d.status = 1
|
|
|
+ <if test = "param.buildingId != null and param.buildingId != 0">
|
|
|
+ and d.building_id = #{param.buildingId}
|
|
|
+ </if>
|
|
|
+ <if test="param.siteId != null and param.siteId != 0">
|
|
|
+ and d.site_id = #{param.siteId}
|
|
|
+ </if>
|
|
|
+ <if test = "param.channelId != null and param.channelId != 0">
|
|
|
+ and d.sys_id = #{param.channelId}
|
|
|
+ </if>
|
|
|
+ <if test="param.custormerId != null and param.custormerId != 0">
|
|
|
+ and d.customer_id = #{param.custormerId}
|
|
|
+ </if>
|
|
|
+ <if test = "param.statDay != null and param.statDay != 0">
|
|
|
+ and t1.stat_day = #{param.statDay}
|
|
|
+ </if>
|
|
|
+ <if test = "param.buildingId != null and param.buildingId != 0">
|
|
|
+ AND t1.building_id = #{param.buildingId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
<select id="queryUnReadDeviceListFor7Day" resultType="com.bz.smart_city.dto.DeviceDto">
|
|
|
SELECT
|
|
|
d.site_id as siteId,
|