Commit bf370952 authored by YunaiV's avatar YunaiV
Browse files

v.1.5.1 发布,优化多租户功能,支持自动创建用户、角色等信息

Showing with 22 additions and 12 deletions
+22 -12
This diff is collapsed.
......@@ -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());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment