优化代码

This commit is contained in:
阿沐 2022-10-25 11:35:24 +08:00
parent ccc71825c7
commit c9f32be88e
2 changed files with 26 additions and 25 deletions

View File

@ -27,6 +27,7 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
/** /**
* 获取分页对象 * 获取分页对象
*
* @param query 分页参数 * @param query 分页参数
*/ */
protected IPage<T> getPage(Query query) { protected IPage<T> getPage(Query query) {
@ -45,7 +46,18 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
} }
/** /**
* MyBatis-Plus 数据权限
*/
protected void dataScopeWrapper(LambdaQueryWrapper<T> queryWrapper) {
DataScope dataScope = getDataScope(null, null);
if (dataScope != null) {
queryWrapper.apply(dataScope.getSqlFilter());
}
}
/**
* 原生SQL 数据权限 * 原生SQL 数据权限
*
* @param tableAlias 表别名多表关联时需要填写表别名 * @param tableAlias 表别名多表关联时需要填写表别名
* @param orgIdAlias 机构ID别名null表示org_id * @param orgIdAlias 机构ID别名null表示org_id
* @return 返回数据权限 * @return 返回数据权限
@ -95,15 +107,4 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
return new DataScope(sqlFilter.toString()); return new DataScope(sqlFilter.toString());
} }
/**
* MyBatis-Plus 数据权限
*/
protected void dataScopeWrapper(LambdaQueryWrapper<T> queryWrapper) {
DataScope dataScope = getDataScope(null, null);
if (dataScope != null){
queryWrapper.apply(dataScope.getSqlFilter());
}
}
} }

View File

@ -72,7 +72,7 @@ public class SecurityConfig {
} }
@Bean @Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// 忽略授权的地址列表 // 忽略授权的地址列表
List<String> permitList = permitResource.getPermitList(); List<String> permitList = permitResource.getPermitList();
String[] permits = permitList.toArray(new String[0]); String[] permits = permitList.toArray(new String[0]);