1. 替换原始 code 签名

2. 服务与模块生成器,支持指定起始端口批量端口分配
This commit is contained in:
chenbowen
2025-09-02 10:15:16 +08:00
parent 287f4bbd7e
commit e99da38fd4
778 changed files with 876 additions and 801 deletions

View File

@@ -10,7 +10,7 @@ import java.util.Set;
/**
* 多租户配置
*
* @author 芋道源码
* @author ZT
*/
@ConfigurationProperties(prefix = "yudao.tenant")
@Data

View File

@@ -11,7 +11,7 @@ import org.aspectj.lang.annotation.Aspect;
* 忽略单位切换,标记指定方法不进行租户切换的覆盖,基于 {@link CompanyVisitIgnore} 注解实现,用于一些全局的逻辑。
* 例如说,一个定时任务,读取所有数据,进行处理。
* 又例如说,读取所有数据,进行缓存。
* @author 芋道源码
* @author ZT
*/
@Aspect
@Slf4j

View File

@@ -15,7 +15,7 @@ import java.lang.annotation.*;
* 1、如果添加到 Controller 类上,则该 URL 自动添加到 {@link TenantProperties#getIgnoreUrls()} 中
* 2、如果添加到 DO 实体类上,则它对应的表名“相当于”自动添加到 {@link TenantProperties#getIgnoreTables()} 中
*
* @author 芋道源码
* @author ZT
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)

View File

@@ -15,7 +15,7 @@ import org.aspectj.lang.annotation.Aspect;
*
* 整体逻辑的实现,和 {@link TenantUtils#executeIgnore(Runnable)} 需要保持一致
*
* @author 芋道源码
* @author ZT
*/
@Aspect
@Slf4j

View File

@@ -5,7 +5,7 @@ import com.alibaba.ttl.TransmittableThreadLocal;
/**
* 公司上下文 Holder
*
* @author 芋道源码
* @author ZT
*/
public class CompanyContextHolder {

View File

@@ -7,7 +7,7 @@ import com.alibaba.ttl.TransmittableThreadLocal;
/**
* 多租户上下文 Holder
*
* @author 芋道源码
* @author ZT
*/
public class TenantContextHolder {

View File

@@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode;
/**
* 拓展多租户的 BaseDO 基类
*
* @author 芋道源码
* @author ZT
*/
@Data
@EqualsAndHashCode(callSuper = true)

View File

@@ -16,7 +16,7 @@ import java.util.Map;
/**
* 基于 MyBatis Plus 多租户的功能,实现 DB 层面的多租户的功能
*
* @author 芋道源码
* @author ZT
*/
public class TenantDatabaseInterceptor implements TenantLineHandler {

View File

@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
*
* 注意,需要保证 JobHandler 的幂等性。因为 Job 因为某个租户执行失败重试时,之前执行成功的租户也会再次执行。
*
* @author 芋道源码
* @author ZT
*/
@Aspect
@RequiredArgsConstructor

View File

@@ -11,7 +11,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
*
* Kafka Producer 发送消息时,增加 {@link TenantKafkaProducerInterceptor} 拦截器
*
* @author 芋道源码
* @author ZT
*/
@Slf4j
public class TenantKafkaEnvironmentPostProcessor implements EnvironmentPostProcessor {

View File

@@ -18,7 +18,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
* 1. Producer 发送消息时,将 {@link TenantContextHolder} 租户编号,添加到消息的 Header 中
* 2. Consumer 消费消息时,将消息的 Header 的租户编号,添加到 {@link TenantContextHolder} 中,通过 {@link InvocableHandlerMethod} 实现
*
* @author 芋道源码
* @author ZT
*/
public class TenantKafkaProducerInterceptor implements ProducerInterceptor<Object, Object> {

View File

@@ -7,7 +7,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
/**
* 多租户的 RabbitMQ 初始化器
*
* @author 芋道源码
* @author ZT
*/
public class TenantRabbitMQInitializer implements BeanPostProcessor {

View File

@@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
* 1. Producer 发送消息时,将 {@link TenantContextHolder} 租户编号,添加到消息的 Header 中
* 2. Consumer 消费消息时,将消息的 Header 的租户编号,添加到 {@link TenantContextHolder} 中,通过 {@link InvocableHandlerMethod} 实现
*
* @author 芋道源码
* @author ZT
*/
public class TenantRabbitMQMessagePostProcessor implements MessagePostProcessor {

View File

@@ -13,7 +13,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
* 1. Producer 发送消息时,将 {@link TenantContextHolder} 租户编号,添加到消息的 Header 中
* 2. Consumer 消费消息时,将消息的 Header 的租户编号,添加到 {@link TenantContextHolder} 中
*
* @author 芋道源码
* @author ZT
*/
public class TenantRedisMessageInterceptor implements RedisMessageInterceptor {

View File

@@ -17,7 +17,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
*
* Consumer 消费消息时,将消息的 Header 的租户编号,添加到 {@link TenantContextHolder} 中,通过 {@link InvocableHandlerMethod} 实现
*
* @author 芋道源码
* @author ZT
*/
public class TenantRocketMQConsumeMessageHook implements ConsumeMessageHook {

View File

@@ -12,7 +12,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
/**
* 多租户的 RocketMQ 初始化器
*
* @author 芋道源码
* @author ZT
*/
public class TenantRocketMQInitializer implements BeanPostProcessor {

View File

@@ -11,7 +11,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
*
* Producer 发送消息时,将 {@link TenantContextHolder} 租户编号,添加到消息的 Header 中
*
* @author 芋道源码
* @author ZT
*/
public class TenantRocketMQSendMessageHook implements SendMessageHook {

View File

@@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
/**
* Tenant 的 RequestInterceptor 实现类Feign 请求时,将 {@link TenantContextHolder} 设置到 header 中,继续透传给被调用的服务
*
* @author 芋道源码
* @author ZT
*/
public class TenantRequestInterceptor implements RequestInterceptor {

View File

@@ -28,7 +28,7 @@ import java.util.Objects;
* 2. 如果请求未带租户的编号,检查是否是忽略的 URL否则也不允许访问。
* 3. 校验租户是合法,例如说被禁用、到期
*
* @author 芋道源码
* @author ZT
*/
@Slf4j
public class TenantSecurityWebFilter extends ApiRequestFilter {

View File

@@ -5,7 +5,7 @@ import java.util.List;
/**
* Tenant 框架 Service 接口,定义获取租户信息
*
* @author 芋道源码
* @author ZT
*/
public interface TenantFrameworkService {

View File

@@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsync
/**
* Tenant 框架 Service 实现类
*
* @author 芋道源码
* @author ZT
*/
@RequiredArgsConstructor
public class TenantFrameworkServiceImpl implements TenantFrameworkService {

View File

@@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_
/**
* 多租户 Util
*
* @author 芋道源码
* @author ZT
*/
public class TenantUtils {

View File

@@ -14,7 +14,7 @@ import java.io.IOException;
* 多租户 Context Web 过滤器
* 将请求 Header 中的 tenant-id 解析出来,添加到 {@link TenantContextHolder} 中,这样后续的 DB 等操作,可以获得到租户编号。
*
* @author 芋道源码
* @author ZT
*/
public class TenantContextWebFilter extends OncePerRequestFilter {