add
This commit is contained in:
@ -91,20 +91,20 @@ public class DataScopeAspect {
|
||||
break;
|
||||
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
|
||||
sqlString.append(StrUtil.format(
|
||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
|
||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = '{}' ) ", deptAlias,
|
||||
role.getRoleId()));
|
||||
} else if (DATA_SCOPE_DEPT.equals(dataScope)) {
|
||||
sqlString.append(StrUtil.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
|
||||
sqlString.append(StrUtil.format(" OR {}.dept_id = '{}' ", deptAlias, user.getDeptId()));
|
||||
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
|
||||
sqlString.append(StrUtil.format(
|
||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or {} )",
|
||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = '{}' or {} )",
|
||||
deptAlias, user.getDeptId(), DatabaseUtil.handleFindInSet(user.getDeptId(), "ancestors")));
|
||||
} else if (DATA_SCOPE_SELF.equals(dataScope)) {
|
||||
if (StrUtil.isNotBlank(userAlias)) {
|
||||
sqlString.append(StrUtil.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
||||
sqlString.append(StrUtil.format(" OR {}.user_id = '{}' ", userAlias, user.getUserId()));
|
||||
} else {
|
||||
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||
sqlString.append(StrUtil.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||
sqlString.append(StrUtil.format(" OR {}.dept_id = '0' ", deptAlias));
|
||||
}
|
||||
}
|
||||
conditions.add(dataScope);
|
||||
@ -112,7 +112,7 @@ public class DataScopeAspect {
|
||||
|
||||
// 多角色情况下,所有角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据
|
||||
if (CollUtil.isEmpty(conditions)) {
|
||||
sqlString.append(StrUtil.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||
sqlString.append(StrUtil.format(" OR {}.dept_id = '0' ", deptAlias));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(sqlString)) {
|
||||
|
Reference in New Issue
Block a user