feat (farm): 设备管理

- 本服务接口
- 对接第三方设备商
This commit is contained in:
达富斌
2025-09-19 17:32:24 +08:00
parent 7e29eafb48
commit 46f9bd6cb9
54 changed files with 2256 additions and 41 deletions

View File

@@ -9,4 +9,24 @@
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getStatisticsInfo"
resultType="cn.iocoder.yudao.module.farm.controller.admin.deviceinfo.vo.v2.DeviceStatisticsRespVO">
SELECT
COALESCE(COUNT(*), 0) AS deviceTotal,
COALESCE(SUM(CASE WHEN device_state = 1 THEN 1 ELSE 0 END), 0) AS deviceOnline,
COALESCE(SUM(CASE WHEN device_state = 2 THEN 1 ELSE 0 END), 0) AS deviceOffline,
COALESCE(SUM(CASE WHEN device_state = 4 THEN 1 ELSE 0 END), 0) AS deviceWarning
FROM farm_device_info
<where>
deleted = b'0'
<if test="baseId != null and baseId != ''">
AND base_id = #{baseId}
</if>
<if test="tenantId != null and tenantId != ''">
AND tenant_id = #{tenantId}
</if>
</where>
</select>
</mapper>