2025-09-28 09:54:42 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.klp.ems.mapper.EmsEnergyConsumptionMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.klp.ems.domain.EmsEnergyConsumption" id="EmsEnergyConsumptionResult">
|
|
|
|
|
<result property="energyConsumptionId" column="energy_consumption_id"/>
|
|
|
|
|
<result property="meterId" column="meter_id"/>
|
|
|
|
|
<result property="startReading" column="start_reading"/>
|
|
|
|
|
<result property="endReading" column="end_reading"/>
|
|
|
|
|
<result property="consumption" column="consumption"/>
|
|
|
|
|
<result property="startTime" column="start_time"/>
|
|
|
|
|
<result property="endTime" column="end_time"/>
|
|
|
|
|
<result property="recordedBy" column="recorded_by"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2025-09-28 23:51:47 +08:00
|
|
|
<select id="selectDailySummary" resultType="com.klp.ems.domain.vo.SummaryDailyVo">
|
|
|
|
|
SELECT
|
|
|
|
|
DATE(end_time) AS day,
|
|
|
|
|
SUM(consumption) AS totalConsumption
|
|
|
|
|
FROM
|
|
|
|
|
ems_energy_consumption
|
|
|
|
|
WHERE
|
|
|
|
|
DATE(end_time) BETWEEN #{startDate} AND #{endDate}
|
|
|
|
|
GROUP BY
|
|
|
|
|
DATE(end_time)
|
|
|
|
|
ORDER BY
|
|
|
|
|
day
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectMonthlySummary" resultType="com.klp.ems.domain.vo.SummaryMonthlyVo">
|
|
|
|
|
SELECT
|
|
|
|
|
DATE_FORMAT(end_time, '%Y-%m') AS month,
|
|
|
|
|
SUM(consumption) AS totalConsumption
|
|
|
|
|
FROM
|
|
|
|
|
ems_energy_consumption
|
|
|
|
|
WHERE
|
|
|
|
|
DATE_FORMAT(end_time, '%Y') = #{year}
|
|
|
|
|
GROUP BY
|
|
|
|
|
DATE_FORMAT(end_time, '%Y-%m')
|
|
|
|
|
ORDER BY
|
|
|
|
|
month
|
|
|
|
|
</select>
|
2025-09-28 09:54:42 +08:00
|
|
|
|
|
|
|
|
</mapper>
|