正在显示
5 个修改的文件
包含
9 行增加
和
17 行删除
| @@ -52,6 +52,11 @@ public class DataScopeAspect | @@ -52,6 +52,11 @@ public class DataScopeAspect | ||
| 52 | */ | 52 | */ |
| 53 | public static final String DATA_SCOPE_SELF = "5"; | 53 | public static final String DATA_SCOPE_SELF = "5"; |
| 54 | 54 | ||
| 55 | + /** | ||
| 56 | + * 数据权限过滤关键字 | ||
| 57 | + */ | ||
| 58 | + public static final String DATA_SCOPE = "dataScope"; | ||
| 59 | + | ||
| 55 | // 配置织入点 | 60 | // 配置织入点 |
| 56 | @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.DataScope)") | 61 | @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.DataScope)") |
| 57 | public void dataScopePointCut() | 62 | public void dataScopePointCut() |
| @@ -138,7 +143,7 @@ public class DataScopeAspect | @@ -138,7 +143,7 @@ public class DataScopeAspect | ||
| 138 | if (StringUtils.isNotBlank(sqlString.toString())) | 143 | if (StringUtils.isNotBlank(sqlString.toString())) |
| 139 | { | 144 | { |
| 140 | BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0]; | 145 | BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0]; |
| 141 | - baseEntity.setDataScope(" AND (" + sqlString.substring(4) + ")"); | 146 | + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); |
| 142 | } | 147 | } |
| 143 | } | 148 | } |
| 144 | 149 |
| @@ -36,9 +36,6 @@ public class BaseEntity implements Serializable | @@ -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,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; |
| @@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -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 |
| @@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 47 | and date_format(r.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') | 47 | and date_format(r.create_time,'%y%m%d') <= 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 |
| @@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -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"> |
-
请 注册 或 登录 后发表评论