Commit 6d06b4bf by 罗志长

fix: 批量编辑设备属性

parent 78ff14d3
......@@ -738,7 +738,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (CollectionUtils.isEmpty(deviceIdList)) {
return;
}
String reqJson = JSON.toJSONString(dto);
for (String deviceId : deviceIdList) {
PlatDeviceBaseAttrDTO platDeviceBaseAttrDTO = getPlatDeviceBaseAttrDTO(deviceId);
Map<String, Object> map = getReqMap(dto,platDeviceBaseAttrDTO);
......@@ -746,12 +745,13 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (StringUtils.isNotEmpty(result)) {
throw new RuntimeException("修改设备属性失败:" + result);
}
List<PlatDeviceOther> otherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, deviceId));
for (PlatDeviceOther platDeviceOther : otherList) {
platDeviceOther.setAttribute(reqJson);
platDeviceOtherService.updateById(platDeviceOther);
}
// 写入设备后等iot MQTT消息回复单独更新,不直接修改数据库属性
// List<PlatDeviceOther> otherList = platDeviceOtherService.list(new QueryWrapper<PlatDeviceOther>().lambda()
// .eq(PlatDeviceOther::getOriDeviceId, deviceId));
// for (PlatDeviceOther platDeviceOther : otherList) {
// platDeviceOther.setAttribute(reqJson);
// platDeviceOtherService.updateById(platDeviceOther);
// }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment