feat:【IoT 物联网】增加(重构) IotDevicePropertyMessageSubscriber 记录设备属性

This commit is contained in:
YunaiV
2025-06-02 15:10:26 +08:00
parent 0bb01eaeeb
commit 1498389d26
9 changed files with 83 additions and 63 deletions

View File

@@ -20,7 +20,7 @@
</foreach>
)
TAGS (
device_key NCHAR(50)
device_name NCHAR(50)
)
</update>
@@ -46,9 +46,9 @@
</update>
<insert id="insert">
INSERT INTO device_property_${device.deviceKey}
INSERT INTO device_property_${device.productKey}_${device.deviceName}
USING product_property_${device.productKey}
TAGS ('${device.deviceKey}')
TAGS ('${device.deviceName}')
(ts, report_time,
<foreach item="key" collection="properties.keys" separator=",">
${@cn.hutool.core.util.StrUtil@toUnderlineCase(key)}
@@ -66,9 +66,10 @@
DESCRIBE product_property_${productKey}
</select>
<select id="selectPageByHistory" resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.data.IotDevicePropertyRespVO">
<select id="selectPageByHistory"
resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.data.IotDevicePropertyRespVO">
SELECT ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} AS `value`, ts AS update_time
FROM device_property_${reqVO.deviceKey}
FROM device_property_${reqVO.productKey}_${reqVO.deviceName}
WHERE ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} IS NOT NULL
AND ts BETWEEN ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[0])}
AND ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[1])}