zw
tq 5 months ago
parent 6310637d6e
commit 072017a12d

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

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

Loading…
Cancel
Save