[fix]:iot home count

This commit is contained in:
alwayssuper
2025-02-28 15:28:38 +08:00
parent 6e1ec8b3eb
commit 0f0ebda469
17 changed files with 217 additions and 209 deletions

View File

@@ -65,7 +65,7 @@
</where>
</select>
<select id="selectDeviceLogUpCountByHour" resultType="cn.iocoder.yudao.module.iot.controller.admin.statistics.vo.IotStatisticsRespVO$TimeData">
<select id="selectDeviceLogUpCountByHour" resultType="java.util.Map">
SELECT
TIMETRUNCATE(ts, 1h) as time,
COUNT(*) as data
@@ -93,7 +93,7 @@
ORDER BY time ASC
</select>
<select id="selectDeviceLogDownCountByHour" resultType="cn.iocoder.yudao.module.iot.controller.admin.statistics.vo.IotStatisticsRespVO$TimeData">
<select id="selectDeviceLogDownCountByHour" resultType="java.util.Map">
SELECT
TIMETRUNCATE(ts, 1h) as time,
COUNT(*) as data

View File

@@ -0,0 +1,25 @@
<?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="cn.iocoder.yudao.module.iot.dal.mysql.device.IotDeviceMapper">
<select id="selectDeviceCountGroupByState" resultType="java.util.Map">
SELECT
state AS `key`,
COUNT(1) AS `value`
FROM iot_device
WHERE deleted = 0
GROUP BY state
</select>
<select id="selectDeviceCountMapByProductId" resultType="java.util.Map">
SELECT
product_id AS `key`,
COUNT(1) AS `value`
FROM iot_device
WHERE deleted = 0
GROUP BY product_id
</select>
</mapper>