【功能修复】IoT:解决物模型的 identifier 存在驼峰情况下,无法插入和查询的情况
This commit is contained in:
parent
76ab64a255
commit
f14cc470aa
|
@ -33,7 +33,7 @@ public interface IotDevicePropertyMapper {
|
|||
List<TDengineTableField> oldFields,
|
||||
List<TDengineTableField> newFields) {
|
||||
oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(),
|
||||
TDengineTableField.FIELD_TS, "device_key", "report_time"));
|
||||
TDengineTableField.FIELD_TS, "report_time"));
|
||||
List<TDengineTableField> addFields = newFields.stream().filter( // 新增的字段
|
||||
newField -> oldFields.stream().noneMatch(oldField -> oldField.getField().equals(newField.getField())))
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
TAGS ('${device.deviceKey}')
|
||||
(ts, report_time,
|
||||
<foreach item="key" collection="properties.keys" separator=",">
|
||||
${key}
|
||||
${@cn.hutool.core.util.StrUtil@toUnderlineCase(key)}
|
||||
</foreach>
|
||||
)
|
||||
VALUES
|
||||
|
@ -67,9 +67,9 @@
|
|||
</select>
|
||||
|
||||
<select id="selectPageByHistory" resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.data.IotDevicePropertyRespVO">
|
||||
SELECT ${reqVO.identifier} AS `value`, ts AS update_time
|
||||
FROM device_property_${reqVO.deviceKey}1
|
||||
WHERE ${reqVO.identifier} IS NOT NULL
|
||||
SELECT ${@cn.hutool.core.util.StrUtil@toUnderlineCase(reqVO.identifier)} AS `value`, ts AS update_time
|
||||
FROM device_property_${reqVO.deviceKey}
|
||||
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])}
|
||||
ORDER BY ts DESC
|
||||
|
|
Loading…
Reference in New Issue