节能减排
This commit is contained in:
parent
d3400648ed
commit
2df2c9410b
|
|
@ -78,4 +78,6 @@ public class DeviceEnergyAnalysis {
|
||||||
* 用于区分所属工程,可作为查询过滤条件
|
* 用于区分所属工程,可作为查询过滤条件
|
||||||
*/
|
*/
|
||||||
private String proId;
|
private String proId;
|
||||||
|
|
||||||
|
private String lastRecordDate;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,28 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAnomalyByDateRange" resultType="com.securitycontrol.screen.domain.DeviceEnergyAnalysis">
|
<select id="selectAnomalyByDateRange" resultType="com.securitycontrol.screen.domain.DeviceEnergyAnalysis">
|
||||||
SELECT id AS id,
|
SELECT dea.id AS id,
|
||||||
device_name AS deviceName,
|
dea.device_name AS deviceName,
|
||||||
stat_date AS statDate,
|
dea.stat_date AS statDate,
|
||||||
consumption_kwh AS consumptionKwh,
|
dea.consumption_kwh AS consumptionKwh,
|
||||||
renewable_used_kwh AS renewableUsedKwh,
|
dea.renewable_used_kwh AS renewableUsedKwh,
|
||||||
anomaly_level AS anomalyLevel,
|
dea.anomaly_level AS anomalyLevel,
|
||||||
anomaly_desc AS anomalyDesc
|
dea.anomaly_desc AS anomalyDesc,
|
||||||
FROM device_energy_analysis
|
|
||||||
WHERE anomaly_flag = 1
|
-- 上次记录时间:同一设备、当前日期之前的最大 stat_date
|
||||||
AND stat_date BETWEEN #{startDate} AND #{endDate}
|
(SELECT MAX(prev.stat_date)
|
||||||
and pro_id = #{proId}
|
FROM device_energy_analysis prev
|
||||||
ORDER BY
|
WHERE prev.device_name = dea.device_name
|
||||||
FIELD(anomaly_level, 'danger', 'warning', 'info') ASC,
|
AND prev.stat_date < dea.stat_date
|
||||||
stat_date ASC;
|
AND prev.pro_id = dea.pro_id) AS lastRecordDate
|
||||||
|
|
||||||
|
FROM device_energy_analysis dea
|
||||||
|
WHERE dea.anomaly_flag = 1
|
||||||
|
AND dea.stat_date BETWEEN #{startDate} AND #{endDate}
|
||||||
|
AND dea.pro_id = #{proId}
|
||||||
|
ORDER BY FIELD(dea.anomaly_level, 'danger', 'warning', 'info') ASC,
|
||||||
|
dea.stat_date ASC;
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectLatestAll" resultType="com.securitycontrol.screen.domain.EnergySavingMeasure">
|
<select id="selectLatestAll" resultType="com.securitycontrol.screen.domain.EnergySavingMeasure">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue