|
|
|
@ -100,9 +100,13 @@ public class DataScopeAspect { |
|
|
|
String userId = ServletUtils.getRequest().getParameter("dataScopeId");//APP如果要走数据权限必须传入这个值
|
|
|
|
System.out.println("APP权限userId------------:" +userId); |
|
|
|
Object redisKeys = redisCache.getCacheObject("shiro:app:"+userId); |
|
|
|
System.out.println("111111111111111111111---------------------:" + redisKeys); |
|
|
|
if (null != redisKeys && redisKeys instanceof User){ |
|
|
|
User appUser = (User) redisKeys; |
|
|
|
System.out.println("2222222222----------------------------------:" + redisKeys); |
|
|
|
System.out.println("是否是管理员:" +appUser.isAdmin()); |
|
|
|
if (!appUser.isAdmin()){ |
|
|
|
System.out.println("333333333333333----------------------------------:" + appUser); |
|
|
|
dataScopeFilter(joinPoint, appUser, controllerDataScope.deptAlias(), |
|
|
|
controllerDataScope.userAlias()); |
|
|
|
} |
|
|
|
@ -147,19 +151,19 @@ public class DataScopeAspect { |
|
|
|
} else if (DATA_SCOPE_DEPT.equals(dataScope)) { |
|
|
|
//别名为空
|
|
|
|
if(StringUtils.isEmpty(deptAlias)) { |
|
|
|
sqlString.append(StringUtils.format(" OR {} dept_id = {} ", deptAlias, user.getDeptId())); |
|
|
|
sqlString.append(StringUtils.format(" OR {} dept_id = '{}' ", deptAlias, user.getDeptId())); |
|
|
|
}else{ |
|
|
|
//别名不为空
|
|
|
|
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); |
|
|
|
sqlString.append(StringUtils.format(" OR {}.dept_id = '{}' ", deptAlias, user.getDeptId())); |
|
|
|
} |
|
|
|
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { |
|
|
|
if(StringUtils.isEmpty(deptAlias)){ |
|
|
|
sqlString.append(StringUtils.format( |
|
|
|
" OR {} dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) <> 0 )", |
|
|
|
" OR {} dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = '{}' or find_in_set( '{}' , ancestors ) <> 0 )", |
|
|
|
deptAlias, user.getDeptId(), user.getDeptId())); |
|
|
|
}else{ |
|
|
|
sqlString.append(StringUtils.format( |
|
|
|
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) <> 0 )", |
|
|
|
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = '{}' or find_in_set( '{}' , ancestors ) <> 0 )", |
|
|
|
deptAlias, user.getDeptId(), user.getDeptId())); |
|
|
|
} |
|
|
|
|
|
|
|
|