全系統每頁、每欄位數據需能核對不能有時間差

合併電站中 - 當日發電量、總發電量 (和電站總攬相同)
This commit is contained in:
wanling040@gmail.com 2022-07-24 00:52:57 +08:00
parent 02cb87ae78
commit 86c8b47e37

View File

@ -55,12 +55,12 @@ namespace SolarPower.Repository.Implement
sql = $@"SELECT m.*,n.*,o.*,p.* FROM sql = $@"SELECT m.*,n.*,o.*,p.* FROM
( (
SELECT SELECT
SUM(TOTALMONEY) AS All_money, SUM(ps.Total_kwh) AS All_kwh,
SUM(TOTALKWH) AS All_kwh, SUM(ps.total_money) AS All_money,
SUM(TOTALCARBON) AS All_Carbon SUM(ps.total_carbon) AS All_Carbon
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a FROM power_station ps
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP WHERE ps.Id IN @ids
) )
AS m, AS m,
( (
@ -116,12 +116,12 @@ namespace SolarPower.Repository.Implement
sql = $@"SELECT m.*,n.*,o.*,p.* FROM sql = $@"SELECT m.*,n.*,o.*,p.* FROM
( (
SELECT SELECT
SUM(TOTALMONEY) AS All_money, SUM(ps.Total_kwh) AS All_kwh,
SUM(TOTALKWH) AS All_kwh, SUM(ps.total_money) AS All_money,
SUM(TOTALCARBON) AS All_Carbon SUM(ps.total_carbon) AS All_Carbon
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a FROM power_station ps
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP WHERE ps.Id IN @ids
) )
AS m, AS m,
( (
@ -151,12 +151,12 @@ namespace SolarPower.Repository.Implement
case 2: case 2:
sql = $@"SELECT m.*,n.*,o.*,p.* FROM sql = $@"SELECT m.*,n.*,o.*,p.* FROM
( (
SELECT SELECT
SUM(TOTALMONEY) AS All_money, SUM(ps.Total_kwh) AS All_kwh,
SUM(TOTALKWH) AS All_kwh, SUM(ps.total_money) AS All_money,
SUM(TOTALCARBON) AS All_Carbon SUM(ps.total_carbon) AS All_Carbon
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a FROM power_station ps
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP WHERE ps.Id IN @ids
) )
AS m, AS m,
( (
@ -189,12 +189,12 @@ namespace SolarPower.Repository.Implement
case 3: case 3:
sql = $@"SELECT m.*,n.*,o.*,p.* FROM sql = $@"SELECT m.*,n.*,o.*,p.* FROM
( (
SELECT SELECT
SUM(TOTALMONEY) AS All_money, SUM(ps.Total_kwh) AS All_kwh,
SUM(TOTALKWH) AS All_kwh, SUM(ps.total_money) AS All_money,
SUM(TOTALCARBON) AS All_Carbon SUM(ps.total_carbon) AS All_Carbon
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a FROM power_station ps
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP WHERE ps.Id IN @ids
) )
AS m, AS m,
( (