站点首页-当日功率曲线按照分钟展示数据

This commit is contained in:
zq
2026-01-27 16:47:48 +08:00
parent 619c05e965
commit 5225f03195
9 changed files with 169 additions and 34 deletions

View File

@ -1141,4 +1141,24 @@
dataTime
) temp
</select>
<select id="getPowerDataByMinute" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PowerStatisListVo">
WITH ranked AS (
SELECT
*,
DATE_FORMAT(
DATE_ADD(DATE_FORMAT(p.update_time, '%Y-%m-%d %H:00:00'), INTERVAL FLOOR(MINUTE(p.update_time) / 5) * 5 MINUTE)
, '%Y-%m-%d %H:%i:%s') AS statisDate,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.data_update_time, '%Y-%m-%d %H:00:00'), FLOOR(MINUTE(p.data_update_time) / 5) ORDER BY p.data_update_time) as rn
FROM
ems_ammeter_data p
<include refid="commonFilter"/>
)
SELECT
t.site_id,
t.statisDate,
<include refid="powerFilter"/>
FROM
ranked as t
GROUP BY t.site_id, t.statisDate
</select>
</mapper>