疯狂的狮子li
2021-09-03 22daef0b51625b888939bdee39f50ca07e2a5ffc
ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.common.core.mybatisplus.core;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
@@ -126,6 +127,9 @@
    */
   @Override
   public boolean saveAll(Collection<T> entityList) {
      if (CollUtil.isEmpty(entityList)) {
         return false;
      }
      return baseMapper.insertAll(entityList) == entityList.size();
   }
@@ -134,6 +138,9 @@
    */
   @Override
   public boolean saveOrUpdateAll(Collection<T> entityList) {
      if (CollUtil.isEmpty(entityList)) {
         return false;
      }
      TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
      Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
      String keyProperty = tableInfo.getKeyProperty();
@@ -149,10 +156,10 @@
            updateList.add(entity);
         }
      }
      if (updateList.size()>0 && updateBatchById(updateList)) {
      if (CollUtil.isNotEmpty(updateList) && updateBatchById(updateList)) {
         row += updateList.size();
      }
        if (addList.size() > 0) {
        if (CollUtil.isNotEmpty(addList)) {
            row += baseMapper.insertAll(addList);
        }
      return row == entityList.size();