mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-04 22:57:12 +08:00
refactor(tenant): 优化租户相关代码
This commit is contained in:
@@ -80,7 +80,7 @@ public class UserContext implements Serializable {
|
||||
*/
|
||||
private Set<RoleContext> roles;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 客户端类型
|
||||
*/
|
||||
private String clientType;
|
||||
@@ -134,5 +134,4 @@ public class UserContext implements Serializable {
|
||||
}
|
||||
return this.pwdResetTime.plusDays(this.passwordExpirationDays).isBefore(LocalDateTime.now());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -143,6 +143,15 @@ public class UserContextHolder {
|
||||
return ExceptionUtils.exToNull(() -> getContext().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户 ID
|
||||
*
|
||||
* @return 租户 ID
|
||||
*/
|
||||
public static Long getTenantId() {
|
||||
return ExceptionUtils.exToNull(() -> getContext().getTenantId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户名
|
||||
*
|
||||
@@ -180,11 +189,4 @@ public class UserContextHolder {
|
||||
StpUtil.checkLogin();
|
||||
return getContext().isAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户ID
|
||||
*/
|
||||
public static Long getTenantId() {
|
||||
return ExceptionUtils.exToNull(() -> getContext().getTenantId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user