This commit is contained in:
abing
2025-06-13 11:40:16 +08:00
parent 437bf23f09
commit 0b93d16b64
1484 changed files with 189715 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package com.core.framework.config;
/**
* TenantContext类 来管理线程局部变量中的租户ID
*/
public class TenantContext {
private static final ThreadLocal<Integer> CURRENT_TENANT = new ThreadLocal<>();
public static void setCurrentTenant(Integer tenantId) {
CURRENT_TENANT.set(tenantId);
}
public static Integer getCurrentTenant() {
return CURRENT_TENANT.get();
}
public static void clear() {
CURRENT_TENANT.remove();
}
}