feat:【IoT 物联网】优化设备数量统计逻辑,简化查询方法并返回更直观的结果映射

This commit is contained in:
YunaiV
2025-06-29 18:59:55 +08:00
parent da60e649df
commit 801a6b970e
4 changed files with 38 additions and 59 deletions

View File

@@ -1,25 +0,0 @@
<?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>