|
|
|
@ -75,16 +75,16 @@
|
|
|
|
|
<if test="price != null ">and price = #{price}</if>
|
|
|
|
|
<if test="monitorSubset != null and monitorSubset != ''">
|
|
|
|
|
and (report_point_water.monitor_id = #{monitorSubset} OR report_point_water.monitor_id IN
|
|
|
|
|
(SELECT t.monitor_id FROM base_monitor_info t WHERE FIND_IN_SET(#{monitorSubset}, ancestors)))
|
|
|
|
|
(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 begin_time between #{params.beginBeginTime} and #{params.endBeginTime}
|
|
|
|
|
and CONVERT(VARCHAR(17), 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 begin_time between #{params.startTime} and #{params.endTime}
|
|
|
|
|
and CONVERT(VARCHAR(17), 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 begin_time between #{params.beginCollectTime} and #{params.endCollectTime}
|
|
|
|
|
and CONVERT(VARCHAR(17), 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>
|
|
|
|
@ -116,9 +116,9 @@
|
|
|
|
|
where report_point_water.objid = #{objid}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="energyConsumptionReportByTime" resultType="java.util.Map">
|
|
|
|
|
select ert.pointTime, sum(if(ert.expend is null, 0, ert.expend)) expend
|
|
|
|
|
select ert.pointTime, sum(isnull(ert.expend,0)) expend
|
|
|
|
|
from (
|
|
|
|
|
select left(rpd.begin_time, #{timeSub}) pointTime, rpd.expend
|
|
|
|
|
select left(left(CONVERT(VARCHAR(17), 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(rpd.begin_time, 10) between #{startDay} and #{endDay}
|
|
|
|
|
and left(CONVERT(VARCHAR(17), 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(rpd.begin_time, 10) pointTime, rpd.expend
|
|
|
|
|
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), 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(rpd.begin_time, 10) between #{startDay} and #{endDay}
|
|
|
|
|
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{startDay} and #{endDay}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
) ert
|
|
|
|
@ -168,21 +168,21 @@
|
|
|
|
|
<select id="datePointWaterList" parameterType="ReportPointWaterDTO" resultMap="ReportPointWaterDTOResult">
|
|
|
|
|
select ert.monitor_id,
|
|
|
|
|
ert.monitor_name,
|
|
|
|
|
CASE
|
|
|
|
|
CAST( CASE
|
|
|
|
|
WHEN #{params.timeSub} = 10 THEN ert.pointTime
|
|
|
|
|
WHEN #{params.timeSub} = 7 THEN concat(ert.pointTime, '-01')
|
|
|
|
|
WHEN #{params.timeSub} = 4 THEN concat(ert.pointTime, '-01-01')
|
|
|
|
|
END AS begin_time,
|
|
|
|
|
CASE
|
|
|
|
|
END AS datetime) AS begin_time,
|
|
|
|
|
CAST( CASE
|
|
|
|
|
WHEN #{params.timeSub} = 10 THEN ert.pointTime
|
|
|
|
|
WHEN #{params.timeSub} = 7 THEN LAST_DAY(concat(ert.pointTime, '-01'))
|
|
|
|
|
WHEN #{params.timeSub} = 4 THEN LAST_DAY(concat(ert.pointTime, '-12-01'))
|
|
|
|
|
END AS end_time,
|
|
|
|
|
sum(if(ert.expend is null, 0, ert.expend)) expend,
|
|
|
|
|
WHEN #{params.timeSub} = 7 THEN EOMONTH(CONVERT(DATE, CONCAT(ert.pointTime, '-01')))
|
|
|
|
|
WHEN #{params.timeSub} = 4 THEN EOMONTH(CONVERT(DATE, CONCAT(ert.pointTime, '-12-01')))
|
|
|
|
|
END AS datetime) AS end_time,
|
|
|
|
|
sum(isnull(ert.expend,0)) expend,
|
|
|
|
|
max(ert.meter_value) meter_value,
|
|
|
|
|
max(ert.monitor_addr) address
|
|
|
|
|
from (
|
|
|
|
|
select rpd.monitor_id, m.monitor_name, left(rpd.begin_time, #{params.timeSub}) pointTime, rpd.expend,
|
|
|
|
|
select rpd.monitor_id, m.monitor_name, left(CONVERT(VARCHAR(17), 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
|
|
|
|
@ -209,9 +209,8 @@
|
|
|
|
|
rpd.monitor_id monitorId,
|
|
|
|
|
m.monitor_name monitorName,
|
|
|
|
|
m.monitor_addr address,
|
|
|
|
|
sum(if(rpd.expend is null, 0, rpd.expend)) expend,
|
|
|
|
|
sum(isnull(rpd.expend,0)) expend,
|
|
|
|
|
max(rpd.meter_value) meterValue,
|
|
|
|
|
GROUP_CONCAT(DISTINCT bpu.user_name SEPARATOR ',') owningUser,
|
|
|
|
|
concat(#{beginCollectTime},' 至 ',#{endCollectTime}) timeRange,
|
|
|
|
|
m.monitor_hierarchy monitorHierarchy,
|
|
|
|
|
m.grade
|
|
|
|
@ -232,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(rpd.begin_time,10) between #{beginCollectTime} and #{endCollectTime}
|
|
|
|
|
and left(CONVERT(VARCHAR(17), rpd.begin_time, 120), 10) between #{beginCollectTime} and #{endCollectTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="monitorIdList != null and monitorIdList.size > 0">
|
|
|
|
|
and rpd.monitor_id IN
|
|
|
|
|