|
@@ -83,7 +83,7 @@ public class IotInfoClassifyServiceImpl implements IotInfoClassifyService {
|
|
|
@CacheEvict(cacheNames = RedisKeyConstants.IOT_INFO_CHILDREN_ID_LIST,
|
|
|
allEntries = true)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateIotInfoClassify(IotInfoClassifySaveReqVO updateReqVO) {
|
|
|
+ public void updateIotInfoClassify(IotInfoClassifySaveReqVO updateReqVO, String type) {
|
|
|
if (updateReqVO.getParentId() == null) {
|
|
|
updateReqVO.setParentId(IotInfoClassifyDO.PARENT_ID_ROOT);
|
|
|
}
|
|
@@ -99,16 +99,19 @@ public class IotInfoClassifyServiceImpl implements IotInfoClassifyService {
|
|
|
iotInfoClassifyMapper.updateById(updateObj);
|
|
|
//更新pms树
|
|
|
List<IotTreeDO> iotTreeDOS = iotTreeMapper.selectListByOriginId(updateObj.getId(), "file");
|
|
|
- List<IotTreeDO> parentIotTreeDOS = iotTreeMapper.selectListByOriginId(updateObj.getParentId(), "file");
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(iotTreeDOS)) {
|
|
|
+ if (CollUtil.isEmpty(iotTreeDOS)) {
|
|
|
throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND.getCode(),"无该部门");
|
|
|
}
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isEmpty(parentIotTreeDOS)) {
|
|
|
- throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND.getCode(),"无该节点");
|
|
|
- }
|
|
|
IotTreeDO iotTreeDO = iotTreeDOS.get(0);
|
|
|
iotTreeDO.setName(updateObj.getName());
|
|
|
- iotTreeDO.setParentId(parentIotTreeDOS.get(0).getId());
|
|
|
+ List<IotTreeDO> parentIotTreeDOS = iotTreeMapper.selectListByOriginId(updateObj.getParentId(), "file");
|
|
|
+ if ("remove".equals(type)) {
|
|
|
+ if (CollUtil.isEmpty(parentIotTreeDOS)) {
|
|
|
+ throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND.getCode(),"无该节点");
|
|
|
+ } else {
|
|
|
+ iotTreeDO.setParentId(parentIotTreeDOS.get(0).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
iotTreeDO.setDeptId(updateObj.getDeptId());
|
|
|
iotTreeMapper.updateById(iotTreeDO);
|
|
|
}
|