mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 优化 兼容部分用户不想给用户分配角色与部门的场景
This commit is contained in:
@ -2,6 +2,7 @@ package org.dromara.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
@ -38,6 +39,9 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||
*/
|
||||
@Override
|
||||
public String getRoleCustom(Long roleId) {
|
||||
if (ObjectUtil.isNull(roleId)) {
|
||||
return "-1";
|
||||
}
|
||||
List<SysRoleDept> list = roleDeptMapper.selectList(
|
||||
new LambdaQueryWrapper<SysRoleDept>()
|
||||
.select(SysRoleDept::getDeptId)
|
||||
@ -45,7 +49,7 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return StreamUtils.join(list, rd -> Convert.toStr(rd.getDeptId()));
|
||||
}
|
||||
return null;
|
||||
return "-1";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,6 +60,9 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||
*/
|
||||
@Override
|
||||
public String getDeptAndChild(Long deptId) {
|
||||
if (ObjectUtil.isNull(deptId)) {
|
||||
return "-1";
|
||||
}
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId)
|
||||
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
||||
@ -64,7 +71,7 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
return StreamUtils.join(ids, Convert::toStr);
|
||||
}
|
||||
return null;
|
||||
return "-1";
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user