perf: 增加绑定时候的字段匹配校验

dev
huangfeng 1 year ago
parent 9aa334a495
commit ead518375b

@ -159,6 +159,30 @@ public class ParamBindServiceImpl implements ParamBindService {
throw new Exception("该逻辑设备实例已被" + list.get(0).getName() + "绑定");
}
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
Optional<ModevType> optionalModevType = modevTypeRepository.findById(modev.getModevtid());
if (optionalModevType.isPresent()) {
ModevType modevType = optionalModevType.get();
if (StringUtils.isNotBlank(modevType.getTablename())) {
List<ColumnModel> columnList = dataService.getDataTableColumns(modevType.getTablename());
for (IcdConfigTypeAtt att : attList) {
if (StringUtils.isNotBlank(att.getColName())) {
boolean found = false;
for (ColumnModel col : columnList) {
if (col.getName().equals(att.getColName())) {
found = true;
break;
}
}
if (!found) {
throw new Exception("当前监控设备对应的表" + modevType.getTablename() + "里不存在配置属性"
+ att.getDoName() + "绑定的字段" + att.getColName());
}
}
}
}
}
modev.setIcdid(item.getIcdid());
modevRepository.save(modev);
}

Loading…
Cancel
Save