浏览代码

数据范围过滤属性调整

RuoYi 5 年之前
父节点
当前提交
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 37
     private String remark;
38 38
 
39
-    /** 数据权限 */
40
-    private String dataScope;
41
-
42 39
     /** 开始时间 */
43 40
     @JsonIgnore
44 41
     private String beginTime;
@@ -110,16 +107,6 @@ public class BaseEntity implements Serializable
110 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 110
     public String getBeginTime()
124 111
     {
125 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 52
     public static final String DATA_SCOPE_SELF = "5";
53 53
 
54
+    /**
55
+     * 数据权限过滤关键字
56
+     */
57
+    public static final String DATA_SCOPE = "dataScope";
58
+
54 59
     @Autowired
55 60
     private AwaitUserService awaitUserService;
56 61
 
@@ -140,7 +145,7 @@ public class DataScopeAspect
140 145
         if (StringUtils.isNotBlank(sqlString.toString()))
141 146
         {
142 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 40
 			AND status = #{status}
41 41
 		</if>
42 42
 		<!-- 数据范围过滤 -->
43
-		${dataScope}
43
+		${params.dataScope}
44 44
 		order by d.parent_id, d.order_num
45 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 47
 			and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
48 48
 		</if>
49 49
 		<!-- 数据范围过滤 -->
50
-		${dataScope}
50
+		${params.dataScope}
51 51
 		order by r.role_sort
52 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 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 79
 		</if>
80 80
 		<!-- 数据范围过滤 -->
81
-		${dataScope}
81
+		${params.dataScope}
82 82
 	</select>
83 83
 	
84 84
 	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">