ソースを参照

修改——
1-处理数据为空时的情况。

zhouhaijun 3 日 前
コミット
0bb522507a

+ 5 - 0
src/main/java/com/bootdo/datas/service/impl/GyDataServiceImpl.java

@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -130,6 +131,10 @@ public class GyDataServiceImpl implements GyDataService {
                 .map(GyDataImportDTO::getId)
                 .collect(Collectors.toList());
 
+        if (CollectionUtils.isEmpty(dataIds)){
+            return list;
+        }
+
         // 一次性获取所有关联的单位信息并转换为Map以提高查询效率
         Map<Long, GyDataUnitDO> unitMap = gyDataUnitService.getByDataIds(dataIds).stream()
                 .collect(Collectors.toMap(GyDataUnitDO::getDataId, Function.identity()));