|
@@ -139,6 +139,16 @@ public class DataScopeAspect
|
|
|
if (DATA_SCOPE_ALL.equals(dataScope))
|
|
|
{
|
|
|
sqlString = new StringBuilder();
|
|
|
+ if( user.getTenantId() != null) { // 租户模式下,全部数据是当前租户下的全部数据
|
|
|
+ if (StringUtils.isNotBlank(userAlias)) // 根据用户表的租户ID过滤
|
|
|
+ {
|
|
|
+ sqlString.append(StringUtils.format(" OR {}.tenant_id = {} ", userAlias, user.getTenantId()));
|
|
|
+ }
|
|
|
+ else // 根据部门表的租户ID过滤
|
|
|
+ {
|
|
|
+ sqlString.append(StringUtils.format(" OR {}.tenant_id = {} ", deptAlias, user.getTenantId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
conditions.add(dataScope);
|
|
|
break;
|
|
|
}
|