diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java index 3a19f8c3..7e07e20f 100644 --- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java +++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java @@ -15,10 +15,7 @@ import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.enums.LoginType; import org.dromara.common.core.enums.TenantStatus; import org.dromara.common.core.exception.user.UserException; -import org.dromara.common.core.utils.DateUtils; -import org.dromara.common.core.utils.MessageUtils; -import org.dromara.common.core.utils.ServletUtils; -import org.dromara.common.core.utils.SpringUtils; +import org.dromara.common.core.utils.*; import org.dromara.common.log.event.LogininforEvent; import org.dromara.common.redis.utils.RedisUtils; import org.dromara.common.satoken.utils.LoginHelper; @@ -210,6 +207,9 @@ public class SysLoginService { if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) { return; } + if (StringUtils.isBlank(tenantId)) { + throw new TenantException("tenant.number.not.blank"); + } SysTenantVo tenant = tenantService.queryByTenantId(tenantId); if (ObjectUtil.isNull(tenant)) { log.info("登录租户:{} 不存在.", tenantId); diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/model/LoginBody.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/model/LoginBody.java index cdff7738..71e49917 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/model/LoginBody.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/model/LoginBody.java @@ -1,13 +1,12 @@ package org.dromara.common.core.domain.model; import jakarta.validation.constraints.Email; -import org.dromara.common.core.constant.UserConstants; +import jakarta.validation.constraints.NotBlank; import lombok.Data; +import org.dromara.common.core.constant.UserConstants; import org.dromara.common.core.validate.auth.*; import org.hibernate.validator.constraints.Length; -import jakarta.validation.constraints.NotBlank; - /** * 用户登录对象 * @@ -42,7 +41,6 @@ public class LoginBody { /** * 租户ID */ - @NotBlank(message = "{tenant.number.not.blank}") private String tenantId; /**