refactor(data): 业务代码里的规则,覆盖计算规则

This commit is contained in:
冷冷 committed 2024-11-22 10:38:15 +08:00
1 parent 02dea27959
commit 075cda636a
2 files changed
+7 -2

No files matched your search

@@ -62,6 +62,11 @@ public class PigxDefaultDataScopeHandle implements DataScopeHandle {
return true;
}
// 业务代码里的规则,覆盖计算规则
if (StrUtil.isNotBlank(dataScope.getUsername()) || CollUtil.isNotEmpty(dataScope.getDeptList())) {
return false;
}
// 获取用户角色ID列表
List<String> roleIdList = user.getAuthorities().stream()
.map(GrantedAuthority::getAuthority)
@@ -26,7 +26,7 @@ import com.pig4cloud.pigx.admin.api.feign.RemoteDataScopeService;
import com.pig4cloud.pigx.common.data.datascope.DataScopeInnerInterceptor;
import com.pig4cloud.pigx.common.data.datascope.DataScopeInterceptor;
import com.pig4cloud.pigx.common.data.datascope.DataScopeSqlInjector;
import com.pig4cloud.pigx.common.data.datascope.PigxDefaultDatascopeHandle;
import com.pig4cloud.pigx.common.data.datascope.PigxDefaultDataScopeHandle;
import com.pig4cloud.pigx.common.data.resolver.SqlFilterArgumentResolver;
import com.pig4cloud.pigx.common.data.tenant.PigxTenantConfigProperties;
import com.pig4cloud.pigx.common.data.tenant.PigxTenantHandler;
@@ -115,7 +115,7 @@ public class MybatisPlusConfiguration implements WebMvcConfigurer {
@ConditionalOnClass(PigxUser.class)
public DataScopeInterceptor dataScopeInterceptor(RemoteDataScopeService dataScopeService) {
DataScopeInnerInterceptor dataScopeInnerInterceptor = new DataScopeInnerInterceptor();
dataScopeInnerInterceptor.setDataScopeHandle(new PigxDefaultDatascopeHandle(dataScopeService));
dataScopeInnerInterceptor.setDataScopeHandle(new PigxDefaultDataScopeHandle(dataScopeService));
return dataScopeInnerInterceptor;
}