mirror of https://gitee.com/stylefeng/roses
【8.1.1】【db】【datasocpe】更新判空策略
parent
146971d55d
commit
7822dccbe4
|
@ -75,9 +75,20 @@ public class DataScopeAop implements Ordered {
|
|||
DataScope datasource = currentMethod.getAnnotation(DataScope.class);
|
||||
|
||||
// 获取当前用户拥有的数据范围
|
||||
UserRoleDataScopeApi userRoleDataScopeApi = SpringUtil.getBean(UserRoleDataScopeApi.class);
|
||||
UserRoleDataScopeApi userRoleDataScopeApi = null;
|
||||
try {
|
||||
userRoleDataScopeApi = SpringUtil.getBean(UserRoleDataScopeApi.class);
|
||||
} catch (Exception e) {
|
||||
log.error("无法找到用户权限获取的类!", e);
|
||||
return point.proceed();
|
||||
}
|
||||
DataScopeConfig userRoleDataScopeConfig = userRoleDataScopeApi.getUserRoleDataScopeConfig();
|
||||
|
||||
// 获取不到用户的数据范围配置,也直接返回
|
||||
if (userRoleDataScopeConfig == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
|
||||
// 如果有单独配置特定的字段,以注解单独配置的字段为主
|
||||
String userIdFieldName = datasource.userIdFieldName();
|
||||
if (StrUtil.isNotBlank(userIdFieldName)) {
|
||||
|
|
Loading…
Reference in New Issue