歸檔 debug , 刪除參數修正

This commit is contained in:
JiaHao Liu 2021-09-13 18:22:32 +08:00
parent a9a9649e8e
commit 90bc390cd7
2 changed files with 3 additions and 5 deletions

View File

@ -62,7 +62,7 @@ namespace SolarPower.Repository.Implement
) INTO @sql ) INTO @sql
FROM inverter_history_hour where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = '{post.Time}'; FROM inverter_history_hour where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = '{post.Time}';
SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m-%d %H'') report_date, ', @sql, SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m-%d %H'') report_date, ', @sql,
', b.KWH hourKWH, round((b.KWH / (SELECT MAX(TODAYKWH) FROM power_station_history_hour WHERE DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') = ''{post.Time}'' and powerstationid = {post.PowerStation}))*100,2) ''hourKWHp'', d.irradiance ''irradiance'', d.Temperature ''temperature'', , b.KWH hourKWH, round((b.KWH / (SELECT MAX(TODAYKWH) FROM power_station_history_hour WHERE DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') = ''{post.Time}'' and powerstationid = {post.PowerStation}))*100,2) ''hourKWHp'', d.irradiance ''irradiance'', d.Temperature ''temperature'',
b.money ''hourmoney'', c.TODAYKWH ''totKWH'', c.KWHKWP ''totKWHKWP'', c.money ''totmoney'', stationName, powerRate daymoney, c.SOLARHOUR tothour,round(b.PR, 2) as pr b.money ''hourmoney'', c.TODAYKWH ''totKWH'', c.KWHKWP ''totKWHKWP'', c.money ''totmoney'', stationName, powerRate daymoney, c.SOLARHOUR tothour,round(b.PR, 2) as pr
FROM inverter_history_hour a left join FROM inverter_history_hour a left join
( # inv ( # inv
@ -238,9 +238,7 @@ namespace SolarPower.Repository.Implement
# select @sql as 'mySelect'; # # select @sql as 'mySelect'; #
PREPARE stmt FROM @sql; PREPARE stmt FROM @sql;
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;";
";
break; break;

View File

@ -43,7 +43,7 @@ namespace solarApp.Service
conn.Open(); conn.Open();
string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID";
var ds = conn.Query<string>(sql, new { siteID = _siteID }).AsList<string>(); var ds = conn.Query<string>(sql, new { siteID = _siteID }).AsList<string>();
_powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; _powerStationID = (ds.Count > 0) ? ds[0].ToString() : "0";
conn.Close(); conn.Close();
} }
#endregion #endregion