From 285fa628a51ccc480ee946d2a1ee5bd13e9ae65a Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 18 三月 2026 13:51:58 +0800
Subject: [PATCH] fix: 工艺路线子集SQL去除产品查询
---
src/main/resources/mapper/energy/EnergyConsumptionDetailMapper.xml | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/energy/EnergyConsumptionDetailMapper.xml b/src/main/resources/mapper/energy/EnergyConsumptionDetailMapper.xml
index 32f2f40..50f4e2f 100644
--- a/src/main/resources/mapper/energy/EnergyConsumptionDetailMapper.xml
+++ b/src/main/resources/mapper/energy/EnergyConsumptionDetailMapper.xml
@@ -41,7 +41,9 @@
</where>
</select>
<select id="calculateEnergy" resultType="java.util.Map">
- select SUM(ecd.dosage) totalEnergyConsumption,
+ select COALESCE(t.totalEnergyConsumption, 0) AS totalEnergyConsumption,
+ COALESCE(t.totalEnergyCost, 0) AS totalEnergyCost
+ from (select SUM(ecd.dosage) totalEnergyConsumption,
SUM(ecd.dosage * e.unit_price) totalEnergyCost
from energy_consumption_detail ecd
left join energy e on ecd.energy_id = e.id
@@ -49,6 +51,7 @@
<if test="c.type != null and c.type != ''">
and ecd.type =#{c.type}
</if>
+ )t
</select>
<select id="energyConsumptionTypeProportion"
resultType="com.ruoyi.energy.dto.EnergyConsumptionTypeDto">
--
Gitblit v1.9.3