|
|
|
|
@ -123,31 +123,40 @@
|
|
|
|
|
where report_point_dnb.objid = #{objid}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="energyConsumptionReportByTime" resultType="java.util.Map">
|
|
|
|
|
select ert.pointTime, sum(isnull(ert.expend,0)) expend
|
|
|
|
|
from (
|
|
|
|
|
select left(CONVERT(VARCHAR(19), rpd.begin_time, 120), #{timeSub}) pointTime, rpd.expend
|
|
|
|
|
from report_point_dnb rpd
|
|
|
|
|
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="publicShareType != null and publicShareType != ''">and m.public_share_type = #{publicShareType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorIdList != null and monitorIdList.size > 0">
|
|
|
|
|
and rpd.monitor_id IN
|
|
|
|
|
<foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">
|
|
|
|
|
#{monitorId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorId != null and monitorId != ''">and rpd.monitor_id = #{monitorId}</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
and rpd.begin_time between #{startTime} and #{endTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
|
|
|
|
|
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
) ert
|
|
|
|
|
group by ert.pointTime
|
|
|
|
|
order by ert.pointTime
|
|
|
|
|
SELECT
|
|
|
|
|
month_tag AS pointTime,
|
|
|
|
|
MAX(meter_value) - MIN(meter_value) expend
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
rpd.meter_value,
|
|
|
|
|
rpd.monitor_id,
|
|
|
|
|
FORMAT ( rpd.record_time, 'yyyy-MM' ) AS month_tag,
|
|
|
|
|
ROW_NUMBER ( ) OVER ( PARTITION BY FORMAT ( rpd.record_time, 'yyyy-MM' ), rpd.monitor_id ORDER BY rpd.record_time ASC ) AS rn_asc,
|
|
|
|
|
ROW_NUMBER ( ) OVER ( PARTITION BY FORMAT ( rpd.record_time, 'yyyy-MM' ), rpd.monitor_id ORDER BY rpd.record_time DESC ) AS rn_desc
|
|
|
|
|
FROM report_point_dnb rpd
|
|
|
|
|
LEFT JOIN base_monitor_info m ON m.monitor_id = rpd.monitor_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="publicShareType != null and publicShareType != ''">and m.public_share_type = #{publicShareType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorIdList != null and monitorIdList.size > 0">
|
|
|
|
|
and rpd.monitor_id IN
|
|
|
|
|
<foreach item="monitorId" collection="monitorIdList" open="(" separator="," close=")">
|
|
|
|
|
#{monitorId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorId != null and monitorId != ''">and rpd.monitor_id = #{monitorId}</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
and rpd.begin_time between #{startTime} and #{endTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
|
|
|
|
|
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
) a
|
|
|
|
|
WHERE rn_asc = 1 OR rn_desc = 1
|
|
|
|
|
GROUP BY month_tag
|
|
|
|
|
ORDER BY month_tag DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="energyConsumptionAnalysisDetails" resultType="java.util.Map">
|
|
|
|
|
|