소스 검색

全量保存或更新时判断数组长度再继续

抓蛙师 3 년 전
부모
커밋
41de169dd2
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java

+ 4 - 2
ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java

@@ -149,10 +149,12 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, V> extends ServiceI
 				updateList.add(entity);
 			}
 		}
-		if (updateBatchById(updateList)) {
+		if (updateList.size()>0 && updateBatchById(updateList)) {
 			row += updateList.size();
 		}
-		row += baseMapper.insertAll(addList);
+        if (addList.size() > 0) {
+            row += baseMapper.insertAll(addList);
+        }
 		return row == entityList.size();
 	}