diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.http b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.http index fa0b4fde08..93c86e146b 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.http +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.http @@ -88,4 +88,14 @@ Authorization: Bearer {{token}} "fileUrl": "http://example.com/firmware.bin", "information": "{\"desc\":\"升级到最新版本\"}" } -} \ No newline at end of file +} + +### 查询设备消息对分页 - 基础查询(设备编号25) +GET {{baseUrl}}/iot/device/message/pair-page?deviceId=25&pageNo=1&pageSize=10 +Authorization: Bearer {{token}} +tenant-id: {{adminTenantId}} + +### 查询设备消息对分页 - 按标识符过滤(identifier=eat) +GET {{baseUrl}}/iot/device/message/pair-page?deviceId=25&identifier=eat&pageNo=1&pageSize=10 +Authorization: Bearer {{token}} +tenant-id: {{adminTenantId}} \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.java index d869527e58..8e9d148c9c 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceMessageController.java @@ -1,14 +1,19 @@ package cn.iocoder.yudao.module.iot.controller.admin.device; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; -import cn.iocoder.yudao.module.iot.controller.admin.device.vo.message.IotDeviceMessageRespVO; import cn.iocoder.yudao.module.iot.controller.admin.device.vo.message.IotDeviceMessagePageReqVO; +import cn.iocoder.yudao.module.iot.controller.admin.device.vo.message.IotDeviceMessageRespPairVO; +import cn.iocoder.yudao.module.iot.controller.admin.device.vo.message.IotDeviceMessageRespVO; import cn.iocoder.yudao.module.iot.controller.admin.device.vo.message.IotDeviceMessageSendReqVO; import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage; import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceMessageDO; +import cn.iocoder.yudao.module.iot.dal.tdengine.IotDeviceMessageMapper; +import cn.iocoder.yudao.module.iot.service.device.IotDeviceService; import cn.iocoder.yudao.module.iot.service.device.message.IotDeviceMessageService; +import cn.iocoder.yudao.module.iot.service.thingmodel.IotThingModelService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; @@ -17,7 +22,12 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.List; +import java.util.Map; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; @Tag(name = "管理后台 - IoT 设备消息") @RestController @@ -27,19 +37,54 @@ public class IotDeviceMessageController { @Resource private IotDeviceMessageService deviceMessageService; + @Resource + private IotDeviceService deviceService; + @Resource + private IotThingModelService thingModelService; + @Resource + private IotDeviceMessageMapper deviceMessageMapper; @GetMapping("/page") @Operation(summary = "获得设备消息分页") @PreAuthorize("@ss.hasPermission('iot:device:message-query')") - public CommonResult> getDeviceLogPage(@Valid IotDeviceMessagePageReqVO pageReqVO) { + public CommonResult> getDeviceMessagePage( + @Valid IotDeviceMessagePageReqVO pageReqVO) { PageResult pageResult = deviceMessageService.getDeviceMessagePage(pageReqVO); return success(BeanUtils.toBean(pageResult, IotDeviceMessageRespVO.class)); } + @GetMapping("/pair-page") + @Operation(summary = "获得设备消息对分页") + @PreAuthorize("@ss.hasPermission('iot:device:message-query')") + public CommonResult> getDeviceMessagePairPage( + @Valid IotDeviceMessagePageReqVO pageReqVO) { + // 1.1 先按照条件,查询 request 的消息(非 reply) + pageReqVO.setReply(false); + PageResult requestMessagePageResult = deviceMessageService.getDeviceMessagePage(pageReqVO); + if (CollUtil.isEmpty(requestMessagePageResult.getList())) { + return success(PageResult.empty()); + } + // 1.2 接着按照 requestIds,批量查询 reply 消息 + List requestIds = convertList(requestMessagePageResult.getList(), IotDeviceMessageDO::getRequestId); + List replyMessageList = deviceMessageService.getDeviceMessageListByRequestIdsAndReply( + pageReqVO.getDeviceId(), requestIds, true); + Map replyMessages = convertMap(replyMessageList, IotDeviceMessageDO::getRequestId); + + // 2. 组装结果 + List pairMessages = convertList(requestMessagePageResult.getList(), + requestMessage -> { + IotDeviceMessageDO replyMessage = replyMessages.get(requestMessage.getRequestId()); + return new IotDeviceMessageRespPairVO() + .setRequest(BeanUtils.toBean(requestMessage, IotDeviceMessageRespVO.class)) + .setReply(BeanUtils.toBean(replyMessage, IotDeviceMessageRespVO.class)); + }); + return success(new PageResult<>(pairMessages, requestMessagePageResult.getTotal())); + } + @PostMapping("/send") @Operation(summary = "发送消息", description = "可用于设备模拟") @PreAuthorize("@ss.hasPermission('iot:device:message-end')") - public CommonResult upstreamDevice(@Valid @RequestBody IotDeviceMessageSendReqVO sendReqVO) { + public CommonResult sendDeviceMessage(@Valid @RequestBody IotDeviceMessageSendReqVO sendReqVO) { deviceMessageService.sendDeviceMessage(BeanUtils.toBean(sendReqVO, IotDeviceMessage.class)); return success(true); } diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessagePageReqVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessagePageReqVO.java index af6fe5c657..1894dc9d7e 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessagePageReqVO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessagePageReqVO.java @@ -5,7 +5,13 @@ import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @Schema(description = "管理后台 - IoT 设备消息分页查询 Request VO") @Data @@ -22,4 +28,15 @@ public class IotDeviceMessagePageReqVO extends PageParam { @Schema(description = "是否上行", example = "true") private Boolean upstream; + @Schema(description = "是否回复", example = "true") + private Boolean reply; + + @Schema(description = "标识符", example = "temperature") + private String identifier; + + @Schema(description = "时间范围", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @Size(min = 2, max = 2, message = "请选择时间范围") + private LocalDateTime[] times; + } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespPairVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespPairVO.java new file mode 100644 index 0000000000..119dd02777 --- /dev/null +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespPairVO.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.iot.controller.admin.device.vo.message; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - IoT 设备消息对 Response VO") +@Data +public class IotDeviceMessageRespPairVO { + + @Schema(description = "请求消息", requiredMode = Schema.RequiredMode.REQUIRED) + private IotDeviceMessageRespVO request; + + @Schema(description = "响应消息") + private IotDeviceMessageRespVO reply; // 通过 requestId 配对 + +} diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespVO.java index 114a0b614b..e53f5acb60 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespVO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/message/IotDeviceMessageRespVO.java @@ -30,6 +30,9 @@ public class IotDeviceMessageRespVO { @Schema(description = "是否回复消息", example = "false", examples = "true") private Boolean reply; + @Schema(description = "标识符", example = "temperature") + private String identifier; + // ========== codec(编解码)字段 ========== @Schema(description = "请求编号", example = "req_123") diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceMessageDO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceMessageDO.java index 8b4dfbffee..9f1f6a6a0c 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceMessageDO.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceMessageDO.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.iot.dal.dataobject.device; import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum; import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage; +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -63,6 +64,13 @@ public class IotDeviceMessageDO { * 计算并存储的目的:方便计算多少条请求、多少条回复 */ private Boolean reply; + /** + * 标识符 + * + * 例如说:{@link IotThingModelDO#getIdentifier()} + * 目前,只有事件上报、服务调用才有!!! + */ + private String identifier; // ========== codec(编解码)字段 ========== diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thingmodel/IotThingModelMapper.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thingmodel/IotThingModelMapper.java index 2ef95d31fb..ac9638b972 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thingmodel/IotThingModelMapper.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thingmodel/IotThingModelMapper.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelP import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; import org.apache.ibatis.annotations.Mapper; -import java.time.LocalDateTime; +import java.util.Collection; import java.util.List; /** @@ -50,6 +50,12 @@ public interface IotThingModelMapper extends BaseMapperX { return selectList(IotThingModelDO::getProductId, productId); } + default List selectListByProductIdAndIdentifiers(Long productId, Collection identifiers) { + return selectList(new LambdaQueryWrapperX() + .eq(IotThingModelDO::getProductId, productId) + .in(IotThingModelDO::getIdentifier, identifiers)); + } + default List selectListByProductIdAndType(Long productId, Integer type) { return selectList(IotThingModelDO::getProductId, productId, IotThingModelDO::getType, type); @@ -69,16 +75,4 @@ public interface IotThingModelMapper extends BaseMapperX { IotThingModelDO::getName, name); } - // TODO @super:用不到,删除下; - /** - * 统计物模型数量 - * - * @param createTime 创建时间,如果为空,则统计所有物模型数量 - * @return 物模型数量 - */ - default Long selectCountByCreateTime(LocalDateTime createTime) { - return selectCount(new LambdaQueryWrapperX() - .geIfPresent(IotThingModelDO::getCreateTime, createTime)); - } - } \ No newline at end of file diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDeviceMessageMapper.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDeviceMessageMapper.java index 9c35269113..b09895fd36 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDeviceMessageMapper.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDeviceMessageMapper.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -57,6 +58,18 @@ public interface IotDeviceMessageMapper { */ Long selectCountByCreateTime(@Param("createTime") Long createTime); + /** + * 按照 requestIds 批量查询消息 + * + * @param deviceId 设备编号 + * @param requestIds 请求编号集合 + * @param reply 是否回复消息 + * @return 消息列表 + */ + List selectListByRequestIdsAndReply(@Param("deviceId") Long deviceId, + @Param("requestIds") Collection requestIds, + @Param("reply") Boolean reply); + /** * 按照时间范围(小时),统计设备的消息数量 */ diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDevicePropertyMapper.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDevicePropertyMapper.java index b5c17e5323..a43dcd7654 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDevicePropertyMapper.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDevicePropertyMapper.java @@ -32,7 +32,7 @@ public interface IotDevicePropertyMapper { List oldFields, List newFields) { oldFields.removeIf(field -> StrUtil.equalsAny(field.getField(), - TDengineTableField.FIELD_TS, "report_time")); + TDengineTableField.FIELD_TS, "report_time", "device_id")); List addFields = newFields.stream().filter( // 新增的字段 newField -> oldFields.stream().noneMatch(oldField -> oldField.getField().equals(newField.getField()))) .collect(Collectors.toList()); diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageService.java index 4e0d761299..4a300dfc30 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageService.java @@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.iot.controller.admin.statistics.vo.IotStatisticsD import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage; import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceMessageDO; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import javax.annotation.Nullable; import java.time.LocalDateTime; @@ -63,6 +65,19 @@ public interface IotDeviceMessageService { */ PageResult getDeviceMessagePage(IotDeviceMessagePageReqVO pageReqVO); + /** + * 获得指定 requestId 的设备消息列表 + * + * @param deviceId 设备编号 + * @param requestIds requestId 列表 + * @param reply 是否回复 + * @return 设备消息列表 + */ + List getDeviceMessageListByRequestIdsAndReply( + @NotNull(message = "设备编号不能为空") Long deviceId, + @NotEmpty(message = "请求编号不能为空") List requestIds, + Boolean reply); + /** * 获得设备消息数量 * diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageServiceImpl.java index 1ae04e291a..b72ceb638a 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/message/IotDeviceMessageServiceImpl.java @@ -76,7 +76,8 @@ public class IotDeviceMessageServiceImpl implements IotDeviceMessageService { void createDeviceLogAsync(IotDeviceMessage message) { IotDeviceMessageDO messageDO = BeanUtils.toBean(message, IotDeviceMessageDO.class) .setUpstream(IotDeviceMessageUtils.isUpstreamMessage(message)) - .setReply(IotDeviceMessageUtils.isReplyMessage(message)); + .setReply(IotDeviceMessageUtils.isReplyMessage(message)) + .setIdentifier(IotDeviceMessageUtils.getIdentifier(message)); if (message.getParams() != null) { messageDO.setParams(JsonUtils.toJsonString(messageDO.getParams())); } @@ -212,6 +213,13 @@ public class IotDeviceMessageServiceImpl implements IotDeviceMessageService { } } + @Override + public List getDeviceMessageListByRequestIdsAndReply(Long deviceId, + List requestIds, + Boolean reply) { + return deviceMessageMapper.selectListByRequestIdsAndReply(deviceId, requestIds, reply); + } + @Override public Long getDeviceMessageCount(LocalDateTime createTime) { return deviceMessageMapper.selectCountByCreateTime(createTime != null ? LocalDateTimeUtil.toEpochMilli(createTime) : null); diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelService.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelService.java index 5cff7022fa..feae3b8adc 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelService.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelService.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelS import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; import jakarta.validation.Valid; +import java.util.Collection; import java.util.List; /** @@ -54,6 +55,15 @@ public interface IotThingModelService { */ List getThingModelListByProductId(Long productId); + /** + * 获得产品物模型列表 + * + * @param productId 产品编号 + * @param identifiers 功能标识列表 + * @return 产品物模型列表 + */ + List getThingModelListByProductIdAndIdentifiers(Long productId, Collection identifiers); + /** * 获得产品物模型列表 * diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelServiceImpl.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelServiceImpl.java index 692999adcd..b56063e265 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelServiceImpl.java +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelServiceImpl.java @@ -131,6 +131,11 @@ public class IotThingModelServiceImpl implements IotThingModelService { return thingModelMapper.selectListByProductId(productId); } + @Override + public List getThingModelListByProductIdAndIdentifiers(Long productId, Collection identifiers) { + return thingModelMapper.selectListByProductIdAndIdentifiers(productId, identifiers); + } + @Override public List getThingModelListByProductIdAndType(Long productId, Integer type) { return thingModelMapper.selectListByProductIdAndType(productId, type); diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDeviceMessageMapper.xml b/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDeviceMessageMapper.xml index 11da5cda8c..bc9da9ec59 100644 --- a/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDeviceMessageMapper.xml +++ b/yudao-module-iot/yudao-module-iot-biz/src/main/resources/mapper/device/IotDeviceMessageMapper.xml @@ -13,6 +13,7 @@ server_id NCHAR(50), upstream BOOL, reply BOOL, + identifier NCHAR(100), request_id NCHAR(50), method NCHAR(100), params NCHAR(2048), @@ -31,22 +32,22 @@ INSERT INTO device_message_${deviceId} ( ts, id, report_time, tenant_id, server_id, - upstream, reply, request_id, method, params, - data, code, msg + upstream, reply, identifier, request_id, method, + params, data, code, msg ) USING device_message TAGS (#{deviceId}) VALUES ( NOW, #{id}, #{reportTime}, #{tenantId}, #{serverId}, - #{upstream}, #{reply}, #{requestId}, #{method}, #{params}, - #{data}, #{code}, #{msg} + #{upstream}, #{reply}, #{identifier}, #{requestId}, #{method}, + #{params}, #{data}, #{code}, #{msg} ) + +