1. 合併電站bug fix

This commit is contained in:
Kai 2021-09-27 14:58:35 +08:00
parent f505216a49
commit c382980d66

View File

@ -38,7 +38,7 @@ namespace SolarPower.Repository.Implement
SUM(TOTALMONEY) AS All_money, SUM(TOTALMONEY) AS All_money,
SUM(TOTALKWH) AS All_kwh, SUM(TOTALKWH) AS All_kwh,
SUM(TOTALCARBON) AS All_Carbon SUM(TOTALCARBON) AS All_Carbon
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN (8) GROUP BY PowerStationId) a from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
) )
AS m, AS m,
@ -74,8 +74,8 @@ namespace SolarPower.Repository.Implement
SUM(TOTALMONEY) AS All_money, SUM(TOTALMONEY) AS All_money,
SUM(TOTALKWH) AS All_kwh, SUM(TOTALKWH) AS All_kwh,
SUM(TOTALCARBON) AS All_Carbon SUM(TOTALCARBON) AS All_Carbon
from power_station_history_month from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
WHERE PowerStationId IN @ids LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
) )
AS m, AS m,
( (
@ -105,8 +105,8 @@ namespace SolarPower.Repository.Implement
SUM(TOTALMONEY) AS All_money, SUM(TOTALMONEY) AS All_money,
SUM(TOTALKWH) AS All_kwh, SUM(TOTALKWH) AS All_kwh,
SUM(TOTALCARBON) AS All_Carbon SUM(TOTALCARBON) AS All_Carbon
from power_station_history_month from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
WHERE PowerStationId IN @ids LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
) )
AS m, AS m,
( (
@ -136,8 +136,8 @@ namespace SolarPower.Repository.Implement
SUM(TOTALMONEY) AS All_money, SUM(TOTALMONEY) AS All_money,
SUM(TOTALKWH) AS All_kwh, SUM(TOTALKWH) AS All_kwh,
SUM(TOTALCARBON) AS All_Carbon SUM(TOTALCARBON) AS All_Carbon
from power_station_history_month from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a
WHERE PowerStationId IN @ids LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
) )
AS m, AS m,
( (