Browse Source

设置白名单默认

lihong 4 months ago
parent
commit
20afad0652

+ 10 - 3
src/main/java/cn/hnthyy/thmz/service/impl/thmz/WhiteListServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.service.impl.thmz;
 
+import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.thmz.WhiteList;
 import cn.hnthyy.thmz.mapper.thmz.WhiteListMapper;
 import cn.hnthyy.thmz.service.thmz.WhiteListService;
@@ -14,9 +15,15 @@ public class WhiteListServiceImpl implements WhiteListService {
     private WhiteListMapper whiteListMapper;
     @Override
     public WhiteList queryByIpAddress(String ipAddress) {
-        if(StringUtils.isBlank(ipAddress)){
-            return null;
+        WhiteList whiteList = new WhiteList();
+        whiteList.setOpId(Constants.BRZZJF_CODE);
+        whiteList.setIpAddress(ipAddress);
+        if(StringUtils.isNotBlank(ipAddress)){
+            WhiteList whiteList1 = whiteListMapper.selectByIpAddress(ipAddress);
+            if(whiteList1 != null){
+                return whiteList1;
+            }
         }
-        return whiteListMapper.selectByIpAddress(ipAddress);
+        return whiteList;
     }
 }