|
|
|
@ -231,23 +231,22 @@
|
|
|
|
select m.parentMonitorId,
|
|
|
|
select m.parentMonitorId,
|
|
|
|
m.parentName,
|
|
|
|
m.parentName,
|
|
|
|
m.is_ammeter,
|
|
|
|
m.is_ammeter,
|
|
|
|
rpd.monitor_id monitorId,
|
|
|
|
rdd.monitor_id monitorId,
|
|
|
|
m.monitor_name monitorName,
|
|
|
|
m.monitor_name monitorName,
|
|
|
|
m.monitor_addr address,
|
|
|
|
m.monitor_addr address,
|
|
|
|
sum(isnull(rpd.expend,0)) expend,
|
|
|
|
sum(isnull(rpd.expend,0)) expend,
|
|
|
|
max(rpd.meter_value) meterValue,
|
|
|
|
|
|
|
|
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
|
|
|
|
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
|
|
|
|
m.monitor_hierarchy monitorHierarchy,
|
|
|
|
m.monitor_hierarchy monitorHierarchy,
|
|
|
|
m.grade,
|
|
|
|
m.grade,
|
|
|
|
m.subentry_id as subentryId,
|
|
|
|
m.subentry_id as subentryId,
|
|
|
|
m.subentry_name as subentryName,
|
|
|
|
m.subentry_name as subentryName,
|
|
|
|
m.public_share_type as publicShareType,
|
|
|
|
m.public_share_type as publicShareType,
|
|
|
|
rdd.kwh1,
|
|
|
|
sum(rdd.kwh1) as kwh1,
|
|
|
|
rdd.kwh2,
|
|
|
|
sum(rdd.kwh2) as kwh2,
|
|
|
|
rdd.kwh3,
|
|
|
|
sum(rdd.kwh3) as kwh3,
|
|
|
|
rdd.kwh4,
|
|
|
|
sum(rdd.kwh4) as kwh4,
|
|
|
|
rdd.total_kwh
|
|
|
|
sum(rdd.total_kwh) meterValue
|
|
|
|
from report_point_dnb rpd
|
|
|
|
from report_day_dnb rdd
|
|
|
|
INNER JOIN (
|
|
|
|
INNER JOIN (
|
|
|
|
SELECT blm.monitor_id parentMonitorId,
|
|
|
|
SELECT blm.monitor_id parentMonitorId,
|
|
|
|
blm.monitor_name parentName,
|
|
|
|
blm.monitor_name parentName,
|
|
|
|
@ -264,18 +263,18 @@
|
|
|
|
LEFT JOIN base_line_monitor bl ON bl.monitor_id = bmi.monitor_id
|
|
|
|
LEFT JOIN base_line_monitor bl ON bl.monitor_id = bmi.monitor_id
|
|
|
|
LEFT JOIN base_line_monitor blm ON blm.objid = bl.parent_id
|
|
|
|
LEFT JOIN base_line_monitor blm ON blm.objid = bl.parent_id
|
|
|
|
LEFT JOIN base_subentry_type bst on TRY_CAST(bmi.subentry_id AS BIGINT) = bst.objid
|
|
|
|
LEFT JOIN base_subentry_type bst on TRY_CAST(bmi.subentry_id AS BIGINT) = bst.objid
|
|
|
|
) m ON m.monitor_id = rpd.monitor_id
|
|
|
|
) m ON m.monitor_id = rdd.monitor_id
|
|
|
|
left join base_monitor_public bmp on m.monitor_id = bmp.monitor_id
|
|
|
|
left join base_monitor_public bmp on m.monitor_id = bmp.monitor_id
|
|
|
|
left join base_public_user bpu on bmp.public_share_id = bpu.id
|
|
|
|
left join base_public_user bpu on bmp.public_share_id = bpu.id
|
|
|
|
left join report_day_dnb rdd on rdd.monitor_id = rpd.monitor_id
|
|
|
|
left join report_point_dnb rpd on rdd.monitor_id = rpd.monitor_id
|
|
|
|
and DATEDIFF(day, rdd.collect_time, rpd.record_time) = 0
|
|
|
|
and DATEDIFF(day, rdd.collect_time, rpd.record_time) = 0
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
|
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
|
|
|
|
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
|
|
|
|
and rpd.begin_time >= #{beginCollectTime} AND rpd.begin_time
|
|
|
|
and rdd.collect_time >= #{beginCollectTime} AND rdd.collect_time
|
|
|
|
<![CDATA[ < ]]> DATEADD(day, 1, #{endCollectTime})
|
|
|
|
<![CDATA[ < ]]> DATEADD(day, 1, #{endCollectTime})
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="monitorIdList != null and monitorIdList.size > 0">
|
|
|
|
<if test="monitorIdList != null and monitorIdList.size > 0">
|
|
|
|
and rpd.monitor_id IN
|
|
|
|
and rdd.monitor_id IN
|
|
|
|
<foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">
|
|
|
|
<foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">
|
|
|
|
#{monitorId}
|
|
|
|
#{monitorId}
|
|
|
|
</foreach>
|
|
|
|
</foreach>
|
|
|
|
@ -286,14 +285,9 @@
|
|
|
|
#{monitorHierarchy}
|
|
|
|
#{monitorHierarchy}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
group by m.parentMonitorId, m.parentName, m.is_ammeter, rpd.monitor_id,
|
|
|
|
group by m.parentMonitorId, m.parentName, m.is_ammeter, rdd.monitor_id,
|
|
|
|
m.monitor_name, m.monitor_addr, m.monitor_hierarchy, m.grade,
|
|
|
|
m.monitor_name, m.monitor_addr, m.monitor_hierarchy, m.grade,
|
|
|
|
m.subentry_id,m.subentry_name,m.public_share_type,
|
|
|
|
m.subentry_id,m.subentry_name,m.public_share_type
|
|
|
|
rdd.kwh1,
|
|
|
|
|
|
|
|
rdd.kwh2,
|
|
|
|
|
|
|
|
rdd.kwh3,
|
|
|
|
|
|
|
|
rdd.kwh4,
|
|
|
|
|
|
|
|
rdd.total_kwh
|
|
|
|
|
|
|
|
order by m.parentName, m.monitor_name
|
|
|
|
order by m.parentName, m.monitor_name
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
<select id="OrderEnergyList" resultMap="ReportOrderEnergyDTOResult">
|
|
|
|
<select id="OrderEnergyList" resultMap="ReportOrderEnergyDTOResult">
|
|
|
|
|