|
@@ -54,6 +54,11 @@ public class DataScopeAspect
|
|
|
*/
|
|
|
public static final String DATA_SCOPE_SELF = "5";
|
|
|
|
|
|
+ /**
|
|
|
+ * 业务层次数据权限
|
|
|
+ */
|
|
|
+ public static final String DATA_SCOPE_BUSINESS = "6";
|
|
|
+
|
|
|
/**
|
|
|
* 数据权限过滤关键字
|
|
|
*/
|
|
@@ -88,7 +93,7 @@ public class DataScopeAspect
|
|
|
if (Validator.isNotNull(currentUser) && !currentUser.isAdmin())
|
|
|
{
|
|
|
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
|
|
|
- controllerDataScope.userAlias());
|
|
|
+ controllerDataScope.userAlias(),controllerDataScope.businessAlias());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -100,7 +105,7 @@ public class DataScopeAspect
|
|
|
* @param user 用户
|
|
|
* @param userAlias 别名
|
|
|
*/
|
|
|
- public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
|
|
|
+ public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String businessAlias)
|
|
|
{
|
|
|
StringBuilder sqlString = new StringBuilder();
|
|
|
|
|
@@ -140,6 +145,12 @@ public class DataScopeAspect
|
|
|
sqlString.append(" OR 1=0 ");
|
|
|
}
|
|
|
}
|
|
|
+ else if (DATA_SCOPE_BUSINESS.equals(dataScope))
|
|
|
+ {
|
|
|
+ sqlString.append(StrUtil.format(
|
|
|
+ " OR {}.id IN ( SELECT business_id FROM sys_role_business WHERE role_id = {} ) ", businessAlias,
|
|
|
+ role.getRoleId()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StrUtil.isNotBlank(sqlString.toString()))
|