update - ems业态能耗分析优化时间查询

master
yinq 1 month ago
parent 0a3fc57e22
commit c7d472b7de

@ -92,13 +92,13 @@
(SELECT t.monitor_id FROM base_monitor_info t WHERE dbo.FIND_IN_SET(#{monitorSubset}, ancestors) > 0))
</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime}
and CONVERT(VARCHAR(19), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime}
</if>
<if test="params.startTime != null and params.startTime != '' and params.endTime != null and params.endTime != ''">
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.startTime} and #{params.endTime}
and CONVERT(VARCHAR(19), begin_time, 120) between #{params.startTime} and #{params.endTime}
</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime}
and CONVERT(VARCHAR(19), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="recordTime != null ">and record_time = #{recordTime}</if>
@ -125,7 +125,7 @@
<select id="energyConsumptionReportByTime" resultType="java.util.Map">
select ert.pointTime, sum(isnull(ert.expend,0)) expend
from (
select left(CONVERT(VARCHAR(17), rpd.begin_time, 120), #{timeSub}) pointTime, rpd.expend
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>
@ -142,7 +142,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -153,7 +153,7 @@
<select id="energyConsumptionAnalysisDetails" resultType="java.util.Map">
select ert.monitor_id, ert.monitor_name, ert.pointTime, sum(isnull(ert.expend,0)) expend
from (
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) pointTime, rpd.expend
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) pointTime, rpd.expend
from report_point_dnb rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -171,7 +171,7 @@
<!-- and rpd.begin_time between #{params.beginCollectTime} and #{params.endCollectTime}-->
<!-- </if>-->
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -196,7 +196,7 @@
max(ert.meter_value) meter_value,
max(ert.monitor_addr) address
from (
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(19), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,
rpd.meter_value,m.monitor_addr
from report_point_dnb rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
@ -246,7 +246,7 @@
left join base_public_user bpu on bmp.public_share_id = bpu.id
<where>
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120),10) between #{beginCollectTime} and #{endCollectTime}
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120),10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="monitorIdList != null and monitorIdList.size > 0">
and rpd.monitor_id IN
@ -460,7 +460,7 @@
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
WHERE 1=1
<if test="params.startTime != null and params.startTime != '' and params.endTime != null and params.endTime != ''">
and CONVERT(VARCHAR(17), rpd.begin_time, 120) between #{params.startTime} and #{params.endTime}
and CONVERT(VARCHAR(19), rpd.begin_time, 120) between #{params.startTime} and #{params.endTime}
</if>
<if test="params.monitorIdList != null and params.monitorIdList.size > 0">
and rpd.monitor_id IN
@ -475,13 +475,13 @@
<select id="datePointDnbGroupList" parameterType="ReportPointDnb" resultType="java.util.Map">
select ert.pointTime begin_time,
sum(isnull(ert.expend, 0)) expend
from (select left(CONVERT(VARCHAR(17), rpd.begin_time, 120), #{params.timeSub}) pointTime,
from (select left(CONVERT(VARCHAR(19), rpd.begin_time, 120), #{params.timeSub}) pointTime,
rpd.expend
from report_point_dnb rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
where 1=1
<if test="params.startTime != null and params.startTime != '' and params.endTime != null and params.endTime != ''">
and CONVERT(VARCHAR(17), rpd.begin_time, 120) between #{params.startTime} and #{params.endTime}
and CONVERT(VARCHAR(19), rpd.begin_time, 120) between #{params.startTime} and #{params.endTime}
</if>
<if test="params.monitorIdList != null and params.monitorIdList.size > 0">
and rpd.monitor_id IN

@ -78,13 +78,13 @@
(SELECT t.monitor_id FROM base_monitor_info t WHERE dbo.FIND_IN_SET(#{monitorSubset}, ancestors) > 0))
</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime}
and CONVERT(VARCHAR(19), begin_time, 120) between #{params.beginBeginTime} and #{params.endBeginTime}
</if>
<if test="params.startTime != null and params.startTime != '' and params.endTime != null and params.endTime != ''">
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.startTime} and #{params.endTime}
and CONVERT(VARCHAR(19), begin_time, 120) between #{params.startTime} and #{params.endTime}
</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and CONVERT(VARCHAR(17), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime}
and CONVERT(VARCHAR(19), begin_time, 120) between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="beginTime != null ">and begin_time = #{beginTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
@ -118,7 +118,7 @@
<select id="energyConsumptionReportByTime" resultType="java.util.Map">
select ert.pointTime, sum(isnull(ert.expend,0)) expend
from (
select left(left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10), #{timeSub}) pointTime, rpd.expend
select left(left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10), #{timeSub}) pointTime, rpd.expend
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -134,7 +134,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -144,7 +144,7 @@
<select id="energyConsumptionAnalysisDetails" resultType="java.util.Map">
select ert.monitor_id, ert.monitor_name, ert.pointTime, sum(if(ert.expend is null, 0, ert.expend)) expend
from (
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) pointTime, rpd.expend
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) pointTime, rpd.expend
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
<where>
@ -158,7 +158,7 @@
and rpd.begin_time between #{startTime} and #{endTime}
</if>
<if test="startDay != null and startDay != '' and endDay != null and endDay != ''">
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
</if>
</where>
) ert
@ -182,7 +182,7 @@
max(ert.meter_value) meter_value,
max(ert.monitor_addr) address
from (
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(19), rpd.begin_time, 120), #{params.timeSub}) pointTime, rpd.expend,
rpd.meter_value,m.monitor_addr
from report_point_water rpd
left join base_monitor_info m on m.monitor_id = rpd.monitor_id
@ -231,7 +231,7 @@
left join base_public_user bpu on bmp.public_share_id = bpu.id
<where>
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{beginCollectTime} and #{endCollectTime}
and left(CONVERT(VARCHAR(19), rpd.begin_time, 120), 10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="monitorIdList != null and monitorIdList.size > 0">
and rpd.monitor_id IN

Loading…
Cancel
Save