链路绑定设备时,如果已绑定设备的物模型属性名称、是否高频、点位序号发送编号后,需要刷新已经配置的映射表中信息

This commit is contained in:
houwei 2024-10-30 08:54:01 +08:00
parent 37ba61bd6a
commit b4fa13524a

View File

@ -237,6 +237,7 @@ public class SysNodeServiceImpl implements SysNodeService {
List<SysTabMapping> addList = new ArrayList<>();
List<SysTabMapping> updateList = new ArrayList<>();
//过滤已经存在的记录
Set<Long> PassedMappingIds = new HashSet<>();
@ -264,6 +265,13 @@ public class SysNodeServiceImpl implements SysNodeService {
if(mappingVoMap.containsKey(key)){
SysTabMappingVo item = mappingVoMap.get(key);
PassedMappingIds.add(item.getId());
SysTabMapping mapping = sysImptabmappingMapper.selectById(item.getId());
mapping.setMeasPointName(iotModelVo.getAttributeName());
mapping.setHighSpeed(iotModelVo.getHighSpeed());
mapping.setPorder(iotModelVo.getPorder());
updateList.add(mapping);
}else{
SysTabMapping mapping = new SysTabMapping();
mapping.setId(SequenceUtils.generateId());
@ -297,6 +305,11 @@ public class SysNodeServiceImpl implements SysNodeService {
if(mappingVoMap.containsKey(key)){
SysTabMappingVo item = mappingVoMap.get(key);
PassedMappingIds.add(item.getId());
SysTabMapping mapping = sysImptabmappingMapper.selectById(item.getId());
mapping.setMeasPointName(iotServiceVo.getServiceName());
mapping.setPorder(iotServiceVo.getPorder());
updateList.add(mapping);
}else{
SysTabMapping mapping = new SysTabMapping();
mapping.setId(SequenceUtils.generateId());
@ -317,6 +330,9 @@ public class SysNodeServiceImpl implements SysNodeService {
if (!CollectionUtils.isEmpty(addList)) {
sysImptabmappingMapper.insertOrUpdateBatch(addList);
}
if (!CollectionUtils.isEmpty(updateList)) {
sysImptabmappingMapper.insertOrUpdateBatch(updateList);
}
//删除为匹配的历史配置
for(SysTabMappingVo item : mappingVoMap.values()){