|
|
@ -1,5 +1,7 @@
|
|
|
|
package com.ruoyi.framework.aspectj;
|
|
|
|
package com.ruoyi.framework.aspectj;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
|
import org.aspectj.lang.annotation.Before;
|
|
|
|
import org.aspectj.lang.annotation.Before;
|
|
|
@ -83,10 +85,15 @@ public class DataScopeAspect
|
|
|
|
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
|
|
|
|
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
StringBuilder sqlString = new StringBuilder();
|
|
|
|
StringBuilder sqlString = new StringBuilder();
|
|
|
|
|
|
|
|
List<String> conditions = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
|
|
for (SysRole role : user.getRoles())
|
|
|
|
for (SysRole role : user.getRoles())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String dataScope = role.getDataScope();
|
|
|
|
String dataScope = role.getDataScope();
|
|
|
|
|
|
|
|
if (conditions.contains(dataScope))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (DATA_SCOPE_ALL.equals(dataScope))
|
|
|
|
if (DATA_SCOPE_ALL.equals(dataScope))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sqlString = new StringBuilder();
|
|
|
|
sqlString = new StringBuilder();
|
|
|
@ -120,6 +127,7 @@ public class DataScopeAspect
|
|
|
|
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
|
|
|
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
conditions.add(dataScope);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(sqlString.toString()))
|
|
|
|
if (StringUtils.isNotBlank(sqlString.toString()))
|
|
|
|