|
@@ -65,7 +65,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public SysDept saveNew(SysDept sysDept, SysDept parentSysDept) {
|
|
|
- sysDept.setDeptId(String.valueOf(idGenerator.nextLongId()));
|
|
|
+ sysDept.setDeptId(idGenerator.nextLongId());
|
|
|
sysDept.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
|
|
MyModelUtil.fillCommonsForInsert(sysDept);
|
|
|
sysDeptMapper.insert(sysDept);
|
|
@@ -100,7 +100,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
}
|
|
|
|
|
|
private void updateParentRelation(SysDept sysDept, SysDept originalSysDept) {
|
|
|
- List<String> originalParentIdList = null;
|
|
|
+ List<Long> originalParentIdList = null;
|
|
|
// 1. 因为层级关系变化了,所以要先遍历出,当前部门的原有父部门Id列表。
|
|
|
if (originalSysDept.getParentId() != null) {
|
|
|
LambdaQueryWrapper<SysDeptRelation> queryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -121,7 +121,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
filter.setDeptId(sysDept.getDeptId());
|
|
|
sysDeptRelationMapper.delete(new QueryWrapper<>(filter));
|
|
|
// 3. 重新计算当前部门的新上级部门列表。
|
|
|
- List<String> newParentIdList = new LinkedList<>();
|
|
|
+ List<Long> newParentIdList = new LinkedList<>();
|
|
|
// 这里要重新计算出当前部门所有新的上级部门Id列表。
|
|
|
if (sysDept.getParentId() != null) {
|
|
|
LambdaQueryWrapper<SysDeptRelation> queryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -137,7 +137,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
// 5. 将当前部门及其所有子部门Id与其新的所有上级部门Id之间,建立关联关系。
|
|
|
List<SysDeptRelation> deptRelationList = new LinkedList<>();
|
|
|
deptRelationList.add(new SysDeptRelation(sysDept.getDeptId(), sysDept.getDeptId()));
|
|
|
- for (String newParentId : newParentIdList) {
|
|
|
+ for (Long newParentId : newParentIdList) {
|
|
|
deptRelationList.add(new SysDeptRelation(newParentId, sysDept.getDeptId()));
|
|
|
for (SysDeptRelation childDeptRelation : childRelationList) {
|
|
|
deptRelationList.add(new SysDeptRelation(newParentId, childDeptRelation.getDeptId()));
|
|
@@ -155,7 +155,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public boolean remove(String deptId) {
|
|
|
+ public boolean remove(Long deptId) {
|
|
|
if (sysDeptMapper.deleteById(deptId) == 0) {
|
|
|
return false;
|
|
|
}
|
|
@@ -207,7 +207,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
* @return 存在返回true,否则false。
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean hasChildren(String deptId) {
|
|
|
+ public boolean hasChildren(Long deptId) {
|
|
|
SysDept filter = new SysDept();
|
|
|
filter.setParentId(deptId);
|
|
|
return getCountByFilter(filter) > 0;
|
|
@@ -220,7 +220,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
* @return 存在返回true,否则false。
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean hasChildrenUser(String deptId) {
|
|
|
+ public boolean hasChildrenUser(Long deptId) {
|
|
|
SysUser sysUser = new SysUser();
|
|
|
sysUser.setDeptId(deptId);
|
|
|
return sysUserService.getCountByFilter(sysUser) > 0;
|
|
@@ -234,9 +234,9 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void addSysDeptPostList(List<SysDeptPost> sysDeptPostList, String deptId) {
|
|
|
+ public void addSysDeptPostList(List<SysDeptPost> sysDeptPostList, Long deptId) {
|
|
|
for (SysDeptPost sysDeptPost : sysDeptPostList) {
|
|
|
- sysDeptPost.setDeptPostId(String.valueOf(idGenerator.nextLongId()));
|
|
|
+ sysDeptPost.setDeptPostId(idGenerator.nextLongId());
|
|
|
sysDeptPost.setDeptId(deptId);
|
|
|
sysDeptPostMapper.insert(sysDeptPost);
|
|
|
}
|
|
@@ -270,7 +270,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public boolean removeSysDeptPost(String deptId, String postId) {
|
|
|
+ public boolean removeSysDeptPost(Long deptId, Long postId) {
|
|
|
SysDeptPost filter = new SysDeptPost();
|
|
|
filter.setDeptId(deptId);
|
|
|
filter.setPostId(postId);
|
|
@@ -285,7 +285,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
* @return 中间表对象。
|
|
|
*/
|
|
|
@Override
|
|
|
- public SysDeptPost getSysDeptPost(String deptId, String postId) {
|
|
|
+ public SysDeptPost getSysDeptPost(Long deptId, Long postId) {
|
|
|
SysDeptPost filter = new SysDeptPost();
|
|
|
filter.setDeptId(deptId);
|
|
|
filter.setPostId(postId);
|
|
@@ -317,7 +317,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
return new LinkedList<>();
|
|
|
}
|
|
|
List<SysDept> deptList = this.getListByParentId("parentId", Long.valueOf(sysDept.getParentId()));
|
|
|
- Set<String> deptIdSet = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toSet());
|
|
|
+ Set<Long> deptIdSet = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toSet());
|
|
|
LambdaQueryWrapper<SysDeptPost> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.in(SysDeptPost::getDeptId, deptIdSet);
|
|
|
queryWrapper.in(SysDeptPost::getPostId, postIdSet);
|
|
@@ -325,13 +325,13 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<String> getLeaderDeptPostIdList(String deptId) {
|
|
|
+ public List<Long> getLeaderDeptPostIdList(Long deptId) {
|
|
|
List<SysDeptPost> resultList = sysDeptPostMapper.getLeaderDeptPostList(deptId);
|
|
|
return resultList.stream().map(SysDeptPost::getDeptPostId).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<String> getUpLeaderDeptPostIdList(String deptId) {
|
|
|
+ public List<Long> getUpLeaderDeptPostIdList(Long deptId) {
|
|
|
SysDept sysDept = this.getById(deptId);
|
|
|
if (sysDept.getParentId() == null) {
|
|
|
return new LinkedList<>();
|
|
@@ -340,7 +340,7 @@ public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements Sy
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<String> getAllChildDeptIdByParentIds(List<Long> parentIds) {
|
|
|
+ public List<Long> getAllChildDeptIdByParentIds(List<Long> parentIds) {
|
|
|
LambdaQueryWrapper<SysDeptRelation> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.in(SysDeptRelation::getParentDeptId, parentIds);
|
|
|
return sysDeptRelationMapper.selectList(queryWrapper)
|