mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
v.1.5.1 发布,优化多租户功能,支持自动创建用户、角色等信息
This commit is contained in:
parent
882660a3a7
commit
5d90760c39
File diff suppressed because one or more lines are too long
@ -32,6 +32,7 @@ import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -80,7 +81,7 @@ public class TenantServiceImpl implements TenantService {
|
||||
@Getter
|
||||
private volatile Date maxUpdateTime;
|
||||
|
||||
@Resource
|
||||
@Autowired(required = false) // 由于 yudao.tenant.enable 配置项,可以关闭多租户的功能,所以这里只能不强制注入
|
||||
private TenantProperties tenantProperties;
|
||||
|
||||
@Resource
|
||||
@ -313,7 +314,7 @@ public class TenantServiceImpl implements TenantService {
|
||||
@Override
|
||||
public void handleTenantInfo(TenantInfoHandler handler) {
|
||||
// 如果禁用,则不执行逻辑
|
||||
if (Boolean.FALSE.equals(tenantProperties.getEnable())) {
|
||||
if (isTenantDisable()) {
|
||||
return;
|
||||
}
|
||||
// 获得租户
|
||||
@ -325,7 +326,7 @@ public class TenantServiceImpl implements TenantService {
|
||||
@Override
|
||||
public void handleTenantMenu(TenantMenuHandler handler) {
|
||||
// 如果禁用,则不执行逻辑
|
||||
if (Boolean.FALSE.equals(tenantProperties.getEnable())) {
|
||||
if (isTenantDisable()) {
|
||||
return;
|
||||
}
|
||||
// 获得租户,然后获得菜单
|
||||
@ -344,4 +345,8 @@ public class TenantServiceImpl implements TenantService {
|
||||
return Objects.equals(tenant.getPackageId(), TenantDO.PACKAGE_ID_SYSTEM);
|
||||
}
|
||||
|
||||
private boolean isTenantDisable() {
|
||||
return tenantProperties == null || Boolean.FALSE.equals(tenantProperties.getEnable());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user