Browse Source

Merge remote-tracking branch 'origin/master'

hym 4 years ago
parent
commit
51ea6f4a1d

+ 6 - 5
user_center/src/main/java/com/huaxu/common/ToolUtil.java

@@ -242,14 +242,15 @@ public class ToolUtil {
         if (!StringUtils.startsWithAny(p, "/") && StringUtils.startsWithAny(path, "\\", "/")) {
             p += "/";
         }
-//        if (!StringUtils.endsWithAny(p, "/") && StringUtils.endsWithAny(path, "\\", "/")) {
-//            p = p;//+ "/";
-//        }
+        if (!StringUtils.endsWithAny(p, "/") && StringUtils.endsWithAny(path, "\\", "/")) {
+            p = p + "/";
+        }
         if (path != null && path.startsWith("/")) {
             p = "/" + p; // linux下路径
         }
-
-
+        if (StringUtils.endsWithAny(p, "/")) {
+            p = p.substring(0, p.length() - 1);
+        }
         return p;
     }
 

+ 5 - 5
user_center/src/main/java/com/huaxu/service/impl/TenantServiceImpl.java

@@ -265,15 +265,15 @@ public class TenantServiceImpl implements TenantService {
         List<Integer> tenantIds = tenantMapper.countIds(tenantDto.getTenantName());
 
         if(tenantIds.size()>1){ //名字匹配多个结果
-            return false;
-        }else if(tenantIds.size() == 0 ){   //没有匹配的结果
             return true;
-        }else if(ToolUtil.isEmpty(tenantDto.getId())){  //新增情况匹配到一个结果
+        }else if(tenantIds.size() == 0 ){   //没有匹配的结果
             return false;
+        }else if(ToolUtil.isEmpty(tenantDto.getId())){  //新增情况匹配到一个结果
+            return true;
         }else if(!tenantDto.getId().equals(tenantIds.get(0))){ //修改时匹配到一个结果,但id不相等
-            return false;
-        }else { //修改时匹配到一个结果且id相等
             return true;
+        }else { //修改时匹配到一个结果且id相等
+            return false;
         }
 
     }