he2802 2 年之前
父節點
當前提交
8a95728d1b

+ 3 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CustomTenantLineHandler.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.framework.mybatisplus;
 
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSON;
@@ -66,10 +67,10 @@ public class CustomTenantLineHandler implements TenantLineHandler {
     @Override
     public Expression getTenantId() {
         String TenantId = ServletUtils.getRequest().getHeader("TenantId");
-        if(!StrUtil.isNotBlank(TenantId)||TenantId==null){
+        if(Validator.isEmpty(TenantId)){
             TenantId = ServletUtils.getResponse().getHeader("TenantId");
             if(enabledTenant){
-                if(!StrUtil.isNotBlank(TenantId)||TenantId==null){
+                if(Validator.isEmpty(TenantId)){
                     int code = HttpStatus.HTTP_UNAVAILABLE;
                     String msg = "企业非法访问";
                     ServletUtils.renderString( ServletUtils.getResponse(), JSON.toJSONString(AjaxResult.error(code, msg)));