新增删除物模型 缓存修改
This commit is contained in:
parent
bd1246782d
commit
0909fe3aae
@ -78,6 +78,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
|
|
||||||
sysIotModel.setRevision(1);
|
sysIotModel.setRevision(1);
|
||||||
sysIotModelMapper.insert(sysIotModel);
|
sysIotModelMapper.insert(sysIotModel);
|
||||||
|
addModelCache(sysIotModel);
|
||||||
SysIotModelVo sysIotModelVo = new SysIotModelVo();
|
SysIotModelVo sysIotModelVo = new SysIotModelVo();
|
||||||
BeanCopyUtils.copy(sysIotModel, sysIotModelVo);
|
BeanCopyUtils.copy(sysIotModel, sysIotModelVo);
|
||||||
sysIotModelVo.setIotModelCode(sysIotModelDto.getIotModelCode().toLowerCase());
|
sysIotModelVo.setIotModelCode(sysIotModelDto.getIotModelCode().toLowerCase());
|
||||||
@ -115,6 +116,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
throw new RuntimeException("该物模型下面有类型,不能删除");
|
throw new RuntimeException("该物模型下面有类型,不能删除");
|
||||||
}
|
}
|
||||||
sysIotModelMapper.deleteById(sysIotModelDto.getId());
|
sysIotModelMapper.deleteById(sysIotModelDto.getId());
|
||||||
|
deleteModelCache(sysIotModelDto.getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,4 +623,11 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addModelCache(SysIotModel sysIotModel){
|
||||||
|
dataService.iotModelMap.put(sysIotModel.getId().toString(), sysIotModel.getIotModelCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteModelCache(Long irn){
|
||||||
|
dataService.iotModelMap.remove(irn.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user