fixed: 部门和资源分类的上下级更改api

This commit is contained in:
none
2023-03-14 17:24:51 +08:00
parent 1867d5fa1a
commit 0d63b433ce
4 changed files with 8 additions and 20 deletions

View File

@@ -197,16 +197,8 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
@Override
@Transactional
public void changeParent(Integer id, Integer parentId, List<Integer> ids) throws NotFoundException {
Department department = new Department();
department.setId(id);
department.setParentId(parentId);
if (parentId.equals(0)) {
department.setParentChain("");
} else {
Department parentDep = findOrFail(parentId);
department.setParentChain(childrenParentChain(parentDep));
}
Department department = findOrFail(id);
update(department, department.getName(), parentId, department.getSort());
// 重置排序
resetSort(ids);
}

View File

@@ -197,16 +197,8 @@ public class ResourceCategoryServiceImpl extends ServiceImpl<ResourceCategoryMap
@Override
@Transactional
public void changeParent(Integer id, Integer parentId, List<Integer> ids) throws NotFoundException {
ResourceCategory category = new ResourceCategory();
category.setId(id);
category.setParentId(parentId);
if (parentId.equals(0)) {
category.setParentChain("");
} else {
ResourceCategory parentResourceCategory = findOrFail(parentId);
category.setParentChain(childrenParentChain(parentResourceCategory));
}
ResourceCategory category = findOrFail(id);
update(category, category.getName(), parentId, category.getSort());
// 重置排序
resetSort(ids);
}