|
|
@@ -1,5 +1,7 @@
|
|
1
|
1
|
package com.ruoyi.common.datascope.aspect;
|
|
2
|
2
|
|
|
|
3
|
+import java.util.ArrayList;
|
|
|
4
|
+import java.util.List;
|
|
3
|
5
|
import org.aspectj.lang.JoinPoint;
|
|
4
|
6
|
import org.aspectj.lang.annotation.Aspect;
|
|
5
|
7
|
import org.aspectj.lang.annotation.Before;
|
|
|
@@ -85,10 +87,15 @@ public class DataScopeAspect
|
|
85
|
87
|
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
|
|
86
|
88
|
{
|
|
87
|
89
|
StringBuilder sqlString = new StringBuilder();
|
|
|
90
|
+ List<String> conditions = new ArrayList<String>();
|
|
88
|
91
|
|
|
89
|
92
|
for (SysRole role : user.getRoles())
|
|
90
|
93
|
{
|
|
91
|
94
|
String dataScope = role.getDataScope();
|
|
|
95
|
+ if (conditions.contains(dataScope))
|
|
|
96
|
+ {
|
|
|
97
|
+ continue;
|
|
|
98
|
+ }
|
|
92
|
99
|
if (DATA_SCOPE_ALL.equals(dataScope))
|
|
93
|
100
|
{
|
|
94
|
101
|
sqlString = new StringBuilder();
|
|
|
@@ -122,6 +129,7 @@ public class DataScopeAspect
|
|
122
|
129
|
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
|
123
|
130
|
}
|
|
124
|
131
|
}
|
|
|
132
|
+ conditions.add(dataScope);
|
|
125
|
133
|
}
|
|
126
|
134
|
|
|
127
|
135
|
if (StringUtils.isNotBlank(sqlString.toString()))
|