Commit f14cc470aacfc3fcd087dfd19259d230a1d2e60c
1 parent
76ab64a2
【功能修复】IoT:解决物模型的 identifier 存在驼峰情况下,无法插入和查询的情况
Showing
2 changed files
with
5 additions
and
5 deletions
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDevicePropertyMapper.java
| @@ -33,7 +33,7 @@ public interface IotDevicePropertyMapper { | @@ -33,7 +33,7 @@ public interface IotDevicePropertyMapper { | ||
| 33 | List<TDengineTableField> oldFields, | 33 | List<TDengineTableField> oldFields, |
| 34 | List<TDengineTableField> newFields) { | 34 | List<TDengineTableField> newFields) { |
| 35 | oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(), | 35 | oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(), |
| 36 | - TDengineTableField.FIELD_TS, "device_key", "report_time")); | 36 | + TDengineTableField.FIELD_TS, "report_time")); |
| 37 | List<TDengineTableField> addFields = newFields.stream().filter( // 新增的字段 | 37 | List<TDengineTableField> addFields = newFields.stream().filter( // 新增的字段 |
| 38 | newField -> oldFields.stream().noneMatch(oldField -> oldField.getField().equals(newField.getField()))) | 38 | newField -> oldFields.stream().noneMatch(oldField -> oldField.getField().equals(newField.getField()))) |
| 39 | .collect(Collectors.toList()); | 39 | .collect(Collectors.toList()); |
yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDevicePropertyMapper.xml
| @@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
| 51 | TAGS ('${device.deviceKey}') | 51 | TAGS ('${device.deviceKey}') |
| 52 | (ts, report_time, | 52 | (ts, report_time, |
| 53 | <foreach item="key" collection="properties.keys" separator=","> | 53 | <foreach item="key" collection="properties.keys" separator=","> |
| 54 | - ${key} | 54 | + ${@cn.hutool.core.util.StrUtil@toUnderlineCase(key)} |
| 55 | </foreach> | 55 | </foreach> |
| 56 | ) | 56 | ) |
| 57 | VALUES | 57 | VALUES |
| @@ -67,9 +67,9 @@ | @@ -67,9 +67,9 @@ | ||
| 67 | </select> | 67 | </select> |
| 68 | 68 | ||
| 69 | <select id="selectPageByHistory" resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.data.IotDevicePropertyRespVO"> | 69 | <select id="selectPageByHistory" resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.data.IotDevicePropertyRespVO"> |
| 70 | - SELECT ${reqVO.identifier} AS `value`, ts AS update_time | ||
| 71 | - FROM device_property_${reqVO.deviceKey}1 | ||
| 72 | - WHERE ${reqVO.identifier} IS NOT NULL | 70 | + SELECT ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} AS `value`, ts AS update_time |
| 71 | + FROM device_property_${reqVO.deviceKey} | ||
| 72 | + WHERE ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} IS NOT NULL | ||
| 73 | AND ts BETWEEN ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[0])} | 73 | AND ts BETWEEN ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[0])} |
| 74 | AND ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[1])} | 74 | AND ${@cn.hutool.core.date.LocalDateTimeUtil@toEpochMilli(reqVO.times[1])} |
| 75 | ORDER BY ts DESC | 75 | ORDER BY ts DESC |