523096025 2 năm trước cách đây
mục cha
commit
6ff720dd97

+ 14 - 0
beeboxs/src/main/java/com/huimv/beeboxs/controller/OpenCotroller.java

@@ -1,5 +1,6 @@
 package com.huimv.beeboxs.controller;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.huimv.beeboxs.common.token.TokenSign;
 import com.huimv.beeboxs.common.utils.Result;
@@ -40,6 +41,9 @@ public class OpenCotroller {
             return new Result(ResultCode.SUCCESS,null);
         }
         List<BaseHiveFarm> location = baseHiveFarmService.list(new QueryWrapper<BaseHiveFarm>().like("location", areaId));
+        if (ObjectUtil.isEmpty(location)){
+            return new Result(ResultCode.SUCCESS,null);
+        }
         List<Integer> farmIds = new ArrayList<>();
         for (BaseHiveFarm baseHiveFarm : location) {
             farmIds.add( baseHiveFarm.getId());
@@ -74,11 +78,21 @@ public class OpenCotroller {
             return new Result(ResultCode.SUCCESS,endMap);
         }
         List<BaseHiveFarm> location = baseHiveFarmService.list(new QueryWrapper<BaseHiveFarm>().like("location", areaId));
+        if (ObjectUtil.isEmpty(location)){
+            Map endMap = new HashMap();
+            endMap.put("stationNum",0);
+            endMap.put("onStationNum",0);
+            endMap.put("offStationNum",0);
+
+
+            return new Result(ResultCode.SUCCESS,endMap);
+        }
         List<Integer> farmIds = new ArrayList<>();
         for (BaseHiveFarm baseHiveFarm : location) {
             farmIds.add( baseHiveFarm.getId());
         }
         QueryWrapper<HiveBaseBeehive> wrapper = new QueryWrapper<>();
+
         wrapper.in("farm_id",farmIds);
         wrapper.eq("type",2);
 

BIN
beeboxs/target/classes/com/huimv/beeboxs/controller/OpenCotroller.class