Commit 61c80ad97b7aa044c9492834c6d753024db37adf
1 parent
1895a9e8
统一 "tenant-id" 的枚举
Showing
4 changed files
with
6 additions
and
6 deletions
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/mq/TenantRedisMessageInterceptor.java
| ... | ... | @@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.mq.core.interceptor.RedisMessageInterceptor; |
| 5 | 5 | import cn.iocoder.yudao.framework.mq.core.message.AbstractRedisMessage; |
| 6 | 6 | import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
| 7 | 7 | |
| 8 | +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; | |
| 9 | + | |
| 8 | 10 | /** |
| 9 | 11 | * 多租户 {@link AbstractRedisMessage} 拦截器 |
| 10 | 12 | * |
| ... | ... | @@ -15,8 +17,6 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
| 15 | 17 | */ |
| 16 | 18 | public class TenantRedisMessageInterceptor implements RedisMessageInterceptor { |
| 17 | 19 | |
| 18 | - private static final String HEADER_TENANT_ID = "tenant-id"; | |
| 19 | - | |
| 20 | 20 | @Override |
| 21 | 21 | public void sendMessageBefore(AbstractRedisMessage message) { |
| 22 | 22 | Long tenantId = TenantContextHolder.getTenantId(); | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/web/TenantContextWebFilter.java
| ... | ... | @@ -18,8 +18,6 @@ import java.io.IOException; |
| 18 | 18 | */ |
| 19 | 19 | public class TenantContextWebFilter extends OncePerRequestFilter { |
| 20 | 20 | |
| 21 | - private static final String HEADER_TENANT_ID = "tenant-id"; | |
| 22 | - | |
| 23 | 21 | @Override |
| 24 | 22 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) |
| 25 | 23 | throws ServletException, IOException { | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| ... | ... | @@ -22,6 +22,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| 22 | 22 | import java.util.Collections; |
| 23 | 23 | import java.util.List; |
| 24 | 24 | |
| 25 | +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; | |
| 25 | 26 | import static springfox.documentation.builders.RequestHandlerSelectors.basePackage; |
| 26 | 27 | |
| 27 | 28 | /** |
| ... | ... | @@ -114,7 +115,8 @@ public class YudaoSwaggerAutoConfiguration { |
| 114 | 115 | // ========== globalRequestParameters ========== |
| 115 | 116 | |
| 116 | 117 | private static List<RequestParameter> globalRequestParameters() { |
| 117 | - RequestParameterBuilder tenantParameter = new RequestParameterBuilder().name("tenant-id").description("租户编号") | |
| 118 | + RequestParameterBuilder tenantParameter = new RequestParameterBuilder() | |
| 119 | + .name(HEADER_TENANT_ID).description("租户编号") | |
| 118 | 120 | .in(ParameterType.HEADER).example(new ExampleBuilder().value(1L).build()); |
| 119 | 121 | return Collections.singletonList(tenantParameter.build()); |
| 120 | 122 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
| ... | ... | @@ -23,7 +23,7 @@ public class WebFrameworkUtils { |
| 23 | 23 | |
| 24 | 24 | private static final String REQUEST_ATTRIBUTE_COMMON_RESULT = "common_result"; |
| 25 | 25 | |
| 26 | - private static final String HEADER_TENANT_ID = "tenant-id"; | |
| 26 | + public static final String HEADER_TENANT_ID = "tenant-id"; | |
| 27 | 27 | |
| 28 | 28 | private static WebProperties properties; |
| 29 | 29 | ... | ... |