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

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

@ -428,4 +428,23 @@
GROUP BY statisDate
ORDER BY statisDate
</select>
<select id="getAvgTempByMinute" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="java.util.Map">
WITH ranked AS (
SELECT
*,
date_format(p.update_time, '%Y-%m-%d %H:00:00') + INTERVAL FLOOR(MINUTE(p.update_time) / 5) * 5 MINUTE AS group_time,
ROW_NUMBER() OVER (PARTITION BY p.device_id, date_format(p.update_time, '%Y-%m-%d %H:00:00'), FLOOR(MINUTE(p.update_time) / 5) ORDER BY p.update_time) as rn
FROM
ems_battery_cluster p
<include refid="statisCommonFilter"/>
)
SELECT
t.site_id,
DATE_FORMAT(t.group_time, '%Y-%m-%d %H:%i:00') as statisDate,
avg(t.avg_cell_temp) as avgTemp
FROM
ranked as t
GROUP BY t.site_id, t.group_time
</select>
</mapper>