mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-14 03:01:36 +08:00
build: continew-starter 2.13.1 => 2.13.2-SNAPSHOT
1.移除 DefaultTenantLineHandler 2.Starter 里调整了租户拦截器优先级
This commit is contained in:
@@ -147,7 +147,6 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe
|
|||||||
- 应用管理:管理第三方系统应用 AK、SK,包含新增、修改、删除、查看密钥、重置密钥等功能,支持设置密钥有效期
|
- 应用管理:管理第三方系统应用 AK、SK,包含新增、修改、删除、查看密钥、重置密钥等功能,支持设置密钥有效期
|
||||||
- 租户管理:管理租户信息,包含新增、修改、删除、分配角色等功能
|
- 租户管理:管理租户信息,包含新增、修改、删除、分配角色等功能
|
||||||
- 租户套餐:管理租户套餐信息,包含新增、修改、删除、查看等功能
|
- 租户套餐:管理租户套餐信息,包含新增、修改、删除、查看等功能
|
||||||
- 租户数据源:管理数据源信息,包含新增、修改、删除、查看、测试等功能
|
|
||||||
- 任务管理:管理系统定时任务,包含新增、修改、删除、执行功能,支持 Cron(可配置式生成 Cron 表达式) 和固定频率
|
- 任务管理:管理系统定时任务,包含新增、修改、删除、执行功能,支持 Cron(可配置式生成 Cron 表达式) 和固定频率
|
||||||
- 任务日志:管理定时任务执行日志,包含停止、重试指定批次,查询集群各节点的详细输出日志等功能
|
- 任务日志:管理定时任务执行日志,包含停止、重试指定批次,查询集群各节点的详细输出日志等功能
|
||||||
- 代码生成:提供根据数据库表自动生成相应的前后端 CRUD 代码的功能,支持同步最新表结构及代码生成预览
|
- 代码生成:提供根据数据库表自动生成相应的前后端 CRUD 代码的功能,支持同步最新表结构及代码生成预览
|
||||||
|
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package top.continew.admin.tenant.config;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
|
||||||
import net.sf.jsqlparser.expression.LongValue;
|
|
||||||
import net.sf.jsqlparser.expression.NullValue;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import top.continew.starter.extension.tenant.autoconfigure.TenantProperties;
|
|
||||||
import top.continew.starter.extension.tenant.context.TenantContextHolder;
|
|
||||||
import top.continew.starter.extension.tenant.enums.TenantIsolationLevel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认租户行级隔离处理器,等待 ContiNew Starter 2.13.2 发布后替换
|
|
||||||
*
|
|
||||||
* @author Charles7c
|
|
||||||
* @since 2025/7/9 11:40
|
|
||||||
*/
|
|
||||||
public class DefaultTenantLineHandler implements TenantLineHandler {
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(DefaultTenantLineHandler.class);
|
|
||||||
private final TenantProperties tenantProperties;
|
|
||||||
|
|
||||||
public DefaultTenantLineHandler(TenantProperties tenantProperties) {
|
|
||||||
this.tenantProperties = tenantProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Expression getTenantId() {
|
|
||||||
Long tenantId = TenantContextHolder.getTenantId();
|
|
||||||
if (tenantId != null) {
|
|
||||||
return new LongValue(tenantId);
|
|
||||||
}
|
|
||||||
log.warn("Tenant ID not found in current context.");
|
|
||||||
return new NullValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTenantIdColumn() {
|
|
||||||
return tenantProperties.getTenantIdColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean ignoreTable(String tableName) {
|
|
||||||
// 忽略租户
|
|
||||||
if (TenantContextHolder.isIgnore()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 忽略数据源级隔离
|
|
||||||
if (TenantIsolationLevel.DATASOURCE.equals(TenantContextHolder.getIsolationLevel())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 忽略指定表
|
|
||||||
return CollUtil.contains(tenantProperties.getIgnoreTables(), tableName);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -16,14 +16,11 @@
|
|||||||
|
|
||||||
package top.continew.admin.tenant.config;
|
package top.continew.admin.tenant.config;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
|
||||||
import org.springdoc.core.models.GroupedOpenApi;
|
import org.springdoc.core.models.GroupedOpenApi;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import top.continew.admin.tenant.service.TenantService;
|
import top.continew.admin.tenant.service.TenantService;
|
||||||
import top.continew.starter.extension.tenant.annotation.ConditionalOnEnabledTenant;
|
import top.continew.starter.extension.tenant.annotation.ConditionalOnEnabledTenant;
|
||||||
import top.continew.starter.extension.tenant.autoconfigure.TenantProperties;
|
|
||||||
import top.continew.starter.extension.tenant.config.TenantProvider;
|
import top.continew.starter.extension.tenant.config.TenantProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,17 +32,6 @@ import top.continew.starter.extension.tenant.config.TenantProvider;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class TenantConfiguration {
|
public class TenantConfiguration {
|
||||||
|
|
||||||
@Autowired(required = false)
|
|
||||||
private TenantProperties tenantProperties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* API 文档分组配置
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public GroupedOpenApi tenantApi() {
|
|
||||||
return GroupedOpenApi.builder().group("tenant").displayName("租户管理").pathsToMatch("/tenant/**").build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户扩展配置属性
|
* 租户扩展配置属性
|
||||||
*/
|
*/
|
||||||
@@ -54,15 +40,6 @@ public class TenantConfiguration {
|
|||||||
return new TenantExtensionProperties();
|
return new TenantExtensionProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户行级隔离处理器(默认),等待 ContiNew Starter 2.13.2 发布后替换
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnEnabledTenant
|
|
||||||
public TenantLineHandler tenantLineHandler() {
|
|
||||||
return new DefaultTenantLineHandler(tenantProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户提供者
|
* 租户提供者
|
||||||
*/
|
*/
|
||||||
@@ -72,4 +49,12 @@ public class TenantConfiguration {
|
|||||||
TenantService tenantService) {
|
TenantService tenantService) {
|
||||||
return new DefaultTenantProvider(tenantExtensionProperties, tenantService);
|
return new DefaultTenantProvider(tenantExtensionProperties, tenantService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 文档分组配置
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi tenantApi() {
|
||||||
|
return GroupedOpenApi.builder().group("tenant").displayName("租户管理").pathsToMatch("/tenant/**").build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
2
pom.xml
2
pom.xml
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>top.continew.starter</groupId>
|
<groupId>top.continew.starter</groupId>
|
||||||
<artifactId>continew-starter</artifactId>
|
<artifactId>continew-starter</artifactId>
|
||||||
<version>2.13.1</version>
|
<version>2.13.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>top.continew.admin</groupId>
|
<groupId>top.continew.admin</groupId>
|
||||||
|
Reference in New Issue
Block a user