1. 替换原始 code 签名
2. 服务与模块生成器,支持指定起始端口批量端口分配
This commit is contained in:
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 基于部门的数据权限 AutoConfiguration
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(LoginUser.class)
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* 数据权限的自动配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AutoConfiguration
|
||||
public class YudaoDataPermissionAutoConfiguration {
|
||||
|
||||
@@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum.TENANT_
|
||||
/**
|
||||
* 数据权限针对 RPC 的自动配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(name = "feign.RequestInterceptor")
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* 基于部门的数据权限 AutoConfiguration
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(LoginUser.class)
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.lang.annotation.*;
|
||||
* 数据权限注解
|
||||
* 可声明在类或者方法上,标识使用的数据权限规则
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
|
||||
/**
|
||||
* {@link cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission} 注解的 Advisor 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 1. 在执行方法前,将 @DataPermission 注解入栈
|
||||
* 2. 在执行方法后,将 @DataPermission 注解出栈
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@DataPermission // 该注解,用于 {@link DATA_PERMISSION_NULL} 的空对象
|
||||
public class DataPermissionAnnotationInterceptor implements MethodInterceptor {
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
/**
|
||||
* {@link DataPermission} 注解的 Context 上下文
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class DataPermissionContextHolder {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
||||
* 它的底层,是基于 MyBatis Plus 的 <a href="https://baomidou.com/plugins/data-permission/">数据权限插件</a>
|
||||
* 核心原理:它会在 SQL 执行前拦截 SQL 语句,并根据用户权限动态添加权限相关的 SQL 片段。这样,只有用户有权限访问的数据才会被查询出来
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class DataPermissionRuleHandler implements MultiDataPermissionHandler {
|
||||
|
||||
@@ -10,7 +10,7 @@ import feign.RequestTemplate;
|
||||
*
|
||||
* 注意:由于 {@link DataPermission} 不支持序列化和反序列化,所以暂时只能传递它的 enable 属性
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class DataPermissionRequestInterceptor implements RequestInterceptor {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* 针对 {@link DataPermissionRequestInterceptor} 的 RPC 调用,设置 {@link DataPermissionContextHolder} 的上下文
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class DataPermissionRpcWebFilter extends OncePerRequestFilter {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
* 数据权限规则接口
|
||||
* 通过实现接口,自定义数据规则。例如说,
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public interface DataPermissionRule {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
* {@link DataPermissionRule} 工厂接口
|
||||
* 作为 {@link DataPermissionRule} 的容器,提供管理能力
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public interface DataPermissionRuleFactory {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.stream.Collectors;
|
||||
* 默认的 DataPermissionRuleFactoryImpl 实现类
|
||||
* 支持通过 {@link DataPermissionContextHolder} 过滤数据权限
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class DataPermissionRuleFactoryImpl implements DataPermissionRuleFactory {
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissi
|
||||
/**
|
||||
* {@link DeptDataPermissionRule} 的自定义配置接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface CompanyDataPermissionRuleCustomizer {
|
||||
|
||||
@@ -52,7 +52,7 @@ import static java.util.Collections.singletonList;
|
||||
* 3)想要保证原 dept_id 和 user_id 都可以看的到,此时使用 dept_id 和 user_id 一起过滤;
|
||||
* 最终过滤条件是 WHERE dept_id = ? OR user_id IN (?, ?, ? ...)
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.datapermission.core.rule.dept;
|
||||
/**
|
||||
* {@link DeptDataPermissionRule} 的自定义配置接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface DeptDataPermissionRuleCustomizer {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 基于部门的数据权限规则
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
package cn.iocoder.yudao.framework.datapermission.core.rule.dept;
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.concurrent.Callable;
|
||||
/**
|
||||
* 数据权限 Util
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class DataPermissionUtils {
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* {@link DataPermissionAnnotationInterceptor} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class DataPermissionAnnotationInterceptorTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import static org.mockito.Mockito.mock;
|
||||
/**
|
||||
* {@link DataPermissionContextHolder} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
class DataPermissionContextHolderTest {
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.when;
|
||||
* 主要复用了 MyBatis Plus 的 TenantLineInnerInterceptorTest 的单元测试
|
||||
* 不过它的单元测试不是很规范,考虑到是复用的,所以暂时不进行修改~
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
public class DataPermissionRuleHandlerTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
/**
|
||||
* {@link DataPermissionRuleFactoryImpl} 单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
class DataPermissionRuleFactoryImplTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* {@link DeptDataPermissionRule} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author ZT
|
||||
*/
|
||||
class DeptDataPermissionRuleTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user