This commit is contained in:
2023-05-16 17:28:43 +08:00
parent 77a83cee8b
commit a161a83023
64 changed files with 1367 additions and 212 deletions

View File

@ -16,5 +16,9 @@
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,30 @@
package com.qiaoba.common.base.utils;
/**
* 租户工具类
*
* @author ailanyin
* @version 1.0
* @since 2023/5/9 12:57
*/
public class TenantUtil {
private static final ThreadLocal<String> TENANT_ID_HOLDER = new ThreadLocal<>();
/**
* 获取登录用户的租户ID
*
* @return username
*/
public static String getTenantId() {
return TENANT_ID_HOLDER.get();
}
public static void clearTenantId() {
TENANT_ID_HOLDER.remove();
}
public static void setTenantId(String tenantId) {
TENANT_ID_HOLDER.set(tenantId);
}
}