fix:TenantDatabaseInterceptor 针对 TenantBaseDO 忽略不正确

(cherry picked from commit bd843a64b6c51b5a36f2e406bd015427edc9ec7d)
This commit is contained in:
YunaiV 2025-05-05 15:31:51 +08:00 committed by dengqichen
parent c07b3e2454
commit 4d86e352a4

View File

@ -66,14 +66,14 @@ public class TenantDatabaseInterceptor implements TenantLineHandler {
} }
private boolean computeIgnoreTable(String tableName) { private boolean computeIgnoreTable(String tableName) {
// 找不到的表说明不是 yudao 项目里的不进行拦截 // 找不到的表说明不是 yudao 项目里的不进行拦截忽略租户
TableInfo tableInfo = TableInfoHelper.getTableInfo(tableName); TableInfo tableInfo = TableInfoHelper.getTableInfo(tableName);
if (tableInfo == null) { if (tableInfo == null) {
return true; return true;
} }
// 如果继承了 TenantBaseDO 基类显然不忽略租户 // 如果继承了 TenantBaseDO 基类显然不忽略租户
if (TenantBaseDO.class.isAssignableFrom(tableInfo.getEntityType())) { if (TenantBaseDO.class.isAssignableFrom(tableInfo.getEntityType())) {
return true; return false;
} }
// 如果添加了 @TenantIgnore 注解显然也不忽略租户 // 如果添加了 @TenantIgnore 注解显然也不忽略租户
TenantIgnore tenantIgnore = tableInfo.getEntityType().getAnnotation(TenantIgnore.class); TenantIgnore tenantIgnore = tableInfo.getEntityType().getAnnotation(TenantIgnore.class);