From 86c8b47e374ecede99edd5400faf4bfd42c418d5 Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Sun, 24 Jul 2022 00:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E7=B3=BB=E7=B5=B1=E6=AF=8F=E9=A0=81?= =?UTF-8?q?=E3=80=81=E6=AF=8F=E6=AC=84=E4=BD=8D=E6=95=B8=E6=93=9A=E9=9C=80?= =?UTF-8?q?=E8=83=BD=E6=A0=B8=E5=B0=8D=E4=B8=8D=E8=83=BD=E6=9C=89=E6=99=82?= =?UTF-8?q?=E9=96=93=E5=B7=AE=20=E5=90=88=E4=BD=B5=E9=9B=BB=E7=AB=99?= =?UTF-8?q?=E4=B8=AD=20-=20=E7=95=B6=E6=97=A5=E7=99=BC=E9=9B=BB=E9=87=8F?= =?UTF-8?q?=E3=80=81=E7=B8=BD=E7=99=BC=E9=9B=BB=E9=87=8F=20(=E5=92=8C?= =?UTF-8?q?=E9=9B=BB=E7=AB=99=E7=B8=BD=E6=94=AC=E7=9B=B8=E5=90=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisStationCombineRepository.cs | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs b/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs index d6e6847..4ddf88c 100644 --- a/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs +++ b/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs @@ -55,12 +55,12 @@ namespace SolarPower.Repository.Implement sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( - SELECT - SUM(TOTALMONEY) AS All_money, - SUM(TOTALKWH) AS All_kwh, - SUM(TOTALCARBON) 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 - LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP + SELECT + SUM(ps.Total_kwh) AS All_kwh, + SUM(ps.total_money) AS All_money, + SUM(ps.total_carbon) AS All_Carbon + FROM power_station ps + WHERE ps.Id IN @ids ) AS m, ( @@ -116,12 +116,12 @@ namespace SolarPower.Repository.Implement sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( - SELECT - SUM(TOTALMONEY) AS All_money, - SUM(TOTALKWH) AS All_kwh, - SUM(TOTALCARBON) 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 - LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP + SELECT + SUM(ps.Total_kwh) AS All_kwh, + SUM(ps.total_money) AS All_money, + SUM(ps.total_carbon) AS All_Carbon + FROM power_station ps + WHERE ps.Id IN @ids ) AS m, ( @@ -151,12 +151,12 @@ namespace SolarPower.Repository.Implement case 2: sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( - SELECT - SUM(TOTALMONEY) AS All_money, - SUM(TOTALKWH) AS All_kwh, - SUM(TOTALCARBON) 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 - LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP + SELECT + SUM(ps.Total_kwh) AS All_kwh, + SUM(ps.total_money) AS All_money, + SUM(ps.total_carbon) AS All_Carbon + FROM power_station ps + WHERE ps.Id IN @ids ) AS m, ( @@ -189,12 +189,12 @@ namespace SolarPower.Repository.Implement case 3: sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( - SELECT - SUM(TOTALMONEY) AS All_money, - SUM(TOTALKWH) AS All_kwh, - SUM(TOTALCARBON) 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 - LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP + SELECT + SUM(ps.Total_kwh) AS All_kwh, + SUM(ps.total_money) AS All_money, + SUM(ps.total_carbon) AS All_Carbon + FROM power_station ps + WHERE ps.Id IN @ids ) AS m, (