add
This commit is contained in:
@ -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>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user