|
|
|
@ -34,6 +34,122 @@
|
|
|
|
ORDER BY beginTime, workUnitCode
|
|
|
|
ORDER BY beginTime, workUnitCode
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="energyStatisticalWaterReportList" resultType="com.os.ems.report.domain.EnergyStatisticalReport"
|
|
|
|
|
|
|
|
parameterType="java.util.HashMap">
|
|
|
|
|
|
|
|
WITH DT AS (SELECT CAST(#{timeSub} AS INT) TIMESUB)
|
|
|
|
|
|
|
|
SELECT WU.WORK_UNIT_CODE workUnitCode,
|
|
|
|
|
|
|
|
WU.WORK_UNIT_NAME workUnitName,
|
|
|
|
|
|
|
|
MAX(RPD.INSTRUMENT_VALUE) instrumentValue,
|
|
|
|
|
|
|
|
SUM(RPD.EXPEND * IIF(MWU.formula_mode = 0, 1, 0) * MWU.proportion) expend,
|
|
|
|
|
|
|
|
MAX(CAST(0 AS DECIMAL(18, 4))) powerExpend,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) beginTime,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) endTime
|
|
|
|
|
|
|
|
FROM ems_base_work_unit WU
|
|
|
|
|
|
|
|
LEFT JOIN ems_base_monitor_work_unit MWU ON MWU.WORK_UNIT_CODE = WU.WORK_UNIT_CODE
|
|
|
|
|
|
|
|
LEFT JOIN ems_report_point_water RPD ON RPD.MONITOR_CODE = MWU.MONITOR_CODE
|
|
|
|
|
|
|
|
CROSS JOIN DT
|
|
|
|
|
|
|
|
WHERE RPD.EXPEND IS NOT NULL
|
|
|
|
|
|
|
|
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
|
|
|
|
|
|
|
|
and FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss') between #{beginCollectTime} and #{endCollectTime}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="workUnitCode != null and workUnitCode != ''">and WU.WORK_UNIT_CODE = #{workUnitCode}</if>
|
|
|
|
|
|
|
|
<if test="workUnitCodeList != null and workUnitCodeList.size > 0">
|
|
|
|
|
|
|
|
and WU.WORK_UNIT_CODE IN
|
|
|
|
|
|
|
|
<foreach item="workUnitCode" collection="workUnitCodeList" open="(" separator="," close=")">
|
|
|
|
|
|
|
|
#{workUnitCode}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
GROUP BY WU.WORK_UNIT_CODE, WU.WORK_UNIT_NAME, SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB)
|
|
|
|
|
|
|
|
ORDER BY beginTime, workUnitCode
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="energyStatisticalSteamReportList" resultType="com.os.ems.report.domain.EnergyStatisticalReport"
|
|
|
|
|
|
|
|
parameterType="java.util.HashMap">
|
|
|
|
|
|
|
|
WITH DT AS (SELECT CAST(#{timeSub} AS INT) TIMESUB)
|
|
|
|
|
|
|
|
SELECT WU.WORK_UNIT_CODE workUnitCode,
|
|
|
|
|
|
|
|
WU.WORK_UNIT_NAME workUnitName,
|
|
|
|
|
|
|
|
MAX(RPD.INSTRUMENT_VALUE) instrumentValue,
|
|
|
|
|
|
|
|
SUM(RPD.EXPEND * IIF(MWU.formula_mode = 0, 1, 0) * MWU.proportion) expend,
|
|
|
|
|
|
|
|
MAX(CAST(0 AS DECIMAL(18, 4))) powerExpend,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) beginTime,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) endTime
|
|
|
|
|
|
|
|
FROM ems_base_work_unit WU
|
|
|
|
|
|
|
|
LEFT JOIN ems_base_monitor_work_unit MWU ON MWU.WORK_UNIT_CODE = WU.WORK_UNIT_CODE
|
|
|
|
|
|
|
|
LEFT JOIN ems_report_point_steam RPD ON RPD.MONITOR_CODE = MWU.MONITOR_CODE
|
|
|
|
|
|
|
|
CROSS JOIN DT
|
|
|
|
|
|
|
|
WHERE RPD.EXPEND IS NOT NULL
|
|
|
|
|
|
|
|
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
|
|
|
|
|
|
|
|
and FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss') between #{beginCollectTime} and #{endCollectTime}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="workUnitCode != null and workUnitCode != ''">and WU.WORK_UNIT_CODE = #{workUnitCode}</if>
|
|
|
|
|
|
|
|
<if test="workUnitCodeList != null and workUnitCodeList.size > 0">
|
|
|
|
|
|
|
|
and WU.WORK_UNIT_CODE IN
|
|
|
|
|
|
|
|
<foreach item="workUnitCode" collection="workUnitCodeList" open="(" separator="," close=")">
|
|
|
|
|
|
|
|
#{workUnitCode}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
GROUP BY WU.WORK_UNIT_CODE, WU.WORK_UNIT_NAME, SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB)
|
|
|
|
|
|
|
|
ORDER BY beginTime, workUnitCode
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="energyStatisticalAirReportList" resultType="com.os.ems.report.domain.EnergyStatisticalReport"
|
|
|
|
|
|
|
|
parameterType="java.util.HashMap">
|
|
|
|
|
|
|
|
WITH DT AS (SELECT CAST(#{timeSub} AS INT) TIMESUB)
|
|
|
|
|
|
|
|
SELECT WU.WORK_UNIT_CODE workUnitCode,
|
|
|
|
|
|
|
|
WU.WORK_UNIT_NAME workUnitName,
|
|
|
|
|
|
|
|
MAX(RPD.INSTRUMENT_VALUE) instrumentValue,
|
|
|
|
|
|
|
|
SUM(RPD.EXPEND * IIF(MWU.formula_mode = 0, 1, 0) * MWU.proportion) expend,
|
|
|
|
|
|
|
|
MAX(CAST(0 AS DECIMAL(18, 4))) powerExpend,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) beginTime,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) endTime
|
|
|
|
|
|
|
|
FROM ems_base_work_unit WU
|
|
|
|
|
|
|
|
LEFT JOIN ems_base_monitor_work_unit MWU ON MWU.WORK_UNIT_CODE = WU.WORK_UNIT_CODE
|
|
|
|
|
|
|
|
LEFT JOIN ems_report_point_air RPD ON RPD.MONITOR_CODE = MWU.MONITOR_CODE
|
|
|
|
|
|
|
|
CROSS JOIN DT
|
|
|
|
|
|
|
|
WHERE RPD.EXPEND IS NOT NULL
|
|
|
|
|
|
|
|
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
|
|
|
|
|
|
|
|
and FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss') between #{beginCollectTime} and #{endCollectTime}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="workUnitCode != null and workUnitCode != ''">and WU.WORK_UNIT_CODE = #{workUnitCode}</if>
|
|
|
|
|
|
|
|
<if test="workUnitCodeList != null and workUnitCodeList.size > 0">
|
|
|
|
|
|
|
|
and WU.WORK_UNIT_CODE IN
|
|
|
|
|
|
|
|
<foreach item="workUnitCode" collection="workUnitCodeList" open="(" separator="," close=")">
|
|
|
|
|
|
|
|
#{workUnitCode}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
GROUP BY WU.WORK_UNIT_CODE, WU.WORK_UNIT_NAME, SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB)
|
|
|
|
|
|
|
|
ORDER BY beginTime, workUnitCode
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="energyStatisticalNitrogenReportList" resultType="com.os.ems.report.domain.EnergyStatisticalReport"
|
|
|
|
|
|
|
|
parameterType="java.util.HashMap">
|
|
|
|
|
|
|
|
WITH DT AS (SELECT CAST(#{timeSub} AS INT) TIMESUB)
|
|
|
|
|
|
|
|
SELECT WU.WORK_UNIT_CODE workUnitCode,
|
|
|
|
|
|
|
|
WU.WORK_UNIT_NAME workUnitName,
|
|
|
|
|
|
|
|
MAX(RPD.INSTRUMENT_VALUE) instrumentValue,
|
|
|
|
|
|
|
|
SUM(RPD.EXPEND * IIF(MWU.formula_mode = 0, 1, 0) * MWU.proportion) expend,
|
|
|
|
|
|
|
|
MAX(CAST(0 AS DECIMAL(18, 4))) powerExpend,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) beginTime,
|
|
|
|
|
|
|
|
SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB) endTime
|
|
|
|
|
|
|
|
FROM ems_base_work_unit WU
|
|
|
|
|
|
|
|
LEFT JOIN ems_base_monitor_work_unit MWU ON MWU.WORK_UNIT_CODE = WU.WORK_UNIT_CODE
|
|
|
|
|
|
|
|
LEFT JOIN ems_report_point_nitrogen RPD ON RPD.MONITOR_CODE = MWU.MONITOR_CODE
|
|
|
|
|
|
|
|
CROSS JOIN DT
|
|
|
|
|
|
|
|
WHERE RPD.EXPEND IS NOT NULL
|
|
|
|
|
|
|
|
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
|
|
|
|
|
|
|
|
and FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss') between #{beginCollectTime} and #{endCollectTime}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="workUnitCode != null and workUnitCode != ''">and WU.WORK_UNIT_CODE = #{workUnitCode}</if>
|
|
|
|
|
|
|
|
<if test="workUnitCodeList != null and workUnitCodeList.size > 0">
|
|
|
|
|
|
|
|
and WU.WORK_UNIT_CODE IN
|
|
|
|
|
|
|
|
<foreach item="workUnitCode" collection="workUnitCodeList" open="(" separator="," close=")">
|
|
|
|
|
|
|
|
#{workUnitCode}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
GROUP BY WU.WORK_UNIT_CODE, WU.WORK_UNIT_NAME, SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB)
|
|
|
|
|
|
|
|
ORDER BY beginTime, workUnitCode
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="peaksValleysConsumptionReportList"
|
|
|
|
<select id="peaksValleysConsumptionReportList"
|
|
|
|
resultType="com.os.ems.report.domain.PeaksValleysConsumptionReport" parameterType="java.util.HashMap">
|
|
|
|
resultType="com.os.ems.report.domain.PeaksValleysConsumptionReport" parameterType="java.util.HashMap">
|
|
|
|
SELECT ebwu.work_unit_code workUnitCode, ebwu.work_unit_name workUnitName,
|
|
|
|
SELECT ebwu.work_unit_code workUnitCode, ebwu.work_unit_name workUnitName,
|
|
|
|
|