| | |
| | | </where> |
| | | </select> |
| | | <select id="calculateEnergy" resultType="java.util.Map"> |
| | | select SUM(COALESCE(ecd.dosage,0)) totalEnergyConsumption, |
| | | SUM(COALESCE(ecd.dosage,0) * COALESCE(e.unit_price,0)) totalEnergyCost |
| | | 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 |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | <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"> |