feat (farm): 设备管理
- 本服务接口 - 对接第三方设备商
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user