master
tq 5 months ago
parent 6310637d6e
commit 072017a12d

@ -46,8 +46,9 @@ public class EmeterEnergyChangeService : BaseServices<EmeterEnergyChange>
d.`code`, d.`code`,
d.`UploadTime`, d.`UploadTime`,
CASE CASE
WHEN d.`Count` = 1 THEN d.`MaxValue` - d.`PreviousMaxValue` WHEN d.`Count` > 1 THEN d.`MaxValue` - d.`MinValue`
ELSE d.`MaxValue` - d.`MinValue` WHEN d.`Count` = 1 AND d.`PreviousMaxValue` IS NOT NULL THEN d.`MaxValue` - d.`PreviousMaxValue`
ELSE 0
END AS `DailyValue` END AS `DailyValue`
FROM FROM
previous_day_max d previous_day_max d
@ -65,6 +66,7 @@ ORDER BY
`UploadTime`; `UploadTime`;
"; ";
List<EmeterEnergyChange> emeterEnergies = await _emeterEnergyChangeRep.SqlQueryable(sql); List<EmeterEnergyChange> emeterEnergies = await _emeterEnergyChangeRep.SqlQueryable(sql);

@ -50,8 +50,9 @@ public class EmeterEnergyService : BaseServices<EmeterEnergy>
d.`code`, d.`code`,
d.`UploadTime`, d.`UploadTime`,
CASE CASE
WHEN d.`Count` = 1 THEN d.`MaxValue` - d.`PreviousMaxValue` WHEN d.`Count` > 1 THEN d.`MaxValue` - d.`MinValue`
ELSE d.`MaxValue` - d.`MinValue` WHEN d.`Count` = 1 AND d.`PreviousMaxValue` IS NOT NULL THEN d.`MaxValue` - d.`PreviousMaxValue`
ELSE 0
END AS `DailyValue` END AS `DailyValue`
FROM FROM
previous_day_max d previous_day_max d
@ -69,6 +70,7 @@ ORDER BY
`UploadTime`; `UploadTime`;
"; ";
List<EmeterEnergy> emeterEnergies = await this.BaseDal.SqlQueryable(sql); List<EmeterEnergy> emeterEnergies = await this.BaseDal.SqlQueryable(sql);
return emeterEnergies; return emeterEnergies;

Loading…
Cancel
Save