[背景服務] 更新 kwh_result default -1.0

[FE API] 更新 API 報表查詢 sql 語法
This commit is contained in:
keke 2023-08-14 13:56:11 +08:00
parent 0b3aab2e69
commit 7313283e8c
2 changed files with 2 additions and 2 deletions

View File

@ -302,7 +302,7 @@ namespace BackendWorkerService.Quartz.Jobs
`count_rawdata` int(11) NULL DEFAULT NULL,
`min_rawdata` decimal(15, 3) NULL DEFAULT NULL,
`max_rawdata` decimal(15, 3) NULL DEFAULT NULL,
`kwh_result` decimal(15, 3) NULL DEFAULT NULL,
`kwh_result` decimal(15, 3) NULL DEFAULT -1.0,
`avg_rawdata` decimal(15, 3) NULL DEFAULT NULL,
`sum_rawdata` decimal(15, 3) NULL DEFAULT NULL,
`is_complete` tinyint(3) UNSIGNED NULL DEFAULT NULL COMMENT '0: 1:',

View File

@ -117,7 +117,7 @@ namespace FrontendWebApi.ApiControllers
var aemmEndDate = input.tableType == "year" ? $"year(DATE_ADD(fd.date, INTERVAL +1 {input.tableType}))" : $"DATE_ADD(fd.date, INTERVAL +1 {input.tableType})";
var aemmStaDate = input.tableType == "year" ? "year(fd.date)" : "fd.date";
var sql = $@"set @i = -1;
select fd.device_number, case when aemm.avg_rawdata = -1 then 'NaN' when aemm.avg_rawdata is null then 0.00 else aemm.avg_rawdata end as avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp
select fd.device_number, case when aemm.avg_rawdata = -1.0 then 'NaN' when aemm.avg_rawdata is null then 0.00 else aemm.avg_rawdata end as avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp
from (
select *
from (