Browse Source

数据范围过滤属性调整

RuoYi 5 years ago
parent
commit
4301f2022b

+ 0 - 13
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java

@@ -36,9 +36,6 @@ public class BaseEntity implements Serializable
36
     /** 备注 */
36
     /** 备注 */
37
     private String remark;
37
     private String remark;
38
 
38
 
39
-    /** 数据权限 */
40
-    private String dataScope;
41
-
42
     /** 开始时间 */
39
     /** 开始时间 */
43
     @JsonIgnore
40
     @JsonIgnore
44
     private String beginTime;
41
     private String beginTime;
@@ -110,16 +107,6 @@ public class BaseEntity implements Serializable
110
         this.remark = remark;
107
         this.remark = remark;
111
     }
108
     }
112
 
109
 
113
-    public String getDataScope()
114
-    {
115
-        return dataScope;
116
-    }
117
-
118
-    public void setDataScope(String dataScope)
119
-    {
120
-        this.dataScope = dataScope;
121
-    }
122
-
123
     public String getBeginTime()
110
     public String getBeginTime()
124
     {
111
     {
125
         return beginTime;
112
         return beginTime;

+ 6 - 1
ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java

@@ -51,6 +51,11 @@ public class DataScopeAspect
51
      */
51
      */
52
     public static final String DATA_SCOPE_SELF = "5";
52
     public static final String DATA_SCOPE_SELF = "5";
53
 
53
 
54
+    /**
55
+     * 数据权限过滤关键字
56
+     */
57
+    public static final String DATA_SCOPE = "dataScope";
58
+
54
     @Autowired
59
     @Autowired
55
     private AwaitUserService awaitUserService;
60
     private AwaitUserService awaitUserService;
56
 
61
 
@@ -140,7 +145,7 @@ public class DataScopeAspect
140
         if (StringUtils.isNotBlank(sqlString.toString()))
145
         if (StringUtils.isNotBlank(sqlString.toString()))
141
         {
146
         {
142
             BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0];
147
             BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0];
143
-            baseEntity.setDataScope(" AND (" + sqlString.substring(4) + ")");
148
+            baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
144
         }
149
         }
145
     }
150
     }
146
 
151
 

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
40
 			AND status = #{status}
40
 			AND status = #{status}
41
 		</if>
41
 		</if>
42
 		<!-- 数据范围过滤 -->
42
 		<!-- 数据范围过滤 -->
43
-		${dataScope}
43
+		${params.dataScope}
44
 		order by d.parent_id, d.order_num
44
 		order by d.parent_id, d.order_num
45
     </select>
45
     </select>
46
     
46
     

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
47
 			and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
47
 			and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
48
 		</if>
48
 		</if>
49
 		<!-- 数据范围过滤 -->
49
 		<!-- 数据范围过滤 -->
50
-		${dataScope}
50
+		${params.dataScope}
51
 		order by r.role_sort
51
 		order by r.role_sort
52
 	</select>
52
 	</select>
53
     
53
     

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
78
 			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
78
 			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
79
 		</if>
79
 		</if>
80
 		<!-- 数据范围过滤 -->
80
 		<!-- 数据范围过滤 -->
81
-		${dataScope}
81
+		${params.dataScope}
82
 	</select>
82
 	</select>
83
 	
83
 	
84
 	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
84
 	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">