Bladeren bron

发布3.5.7-SNAPSHOT快照.

nieqiurong 1 jaar geleden
bovenliggende
commit
3cf9540f5d

+ 4 - 0
changelog-temp.md

@@ -0,0 +1,4 @@
+- feat: BaseMapper新增批量操作与SaveOrUpdate方法
+- feat: BaseMapper新增批量操作方法返回值List<BatchResult>
+- feat: BaseMapper方法逻辑删除默认支持填充
+- feat: 调整Service层逻辑删除填充逻辑处理

+ 1 - 7
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/Db.java

@@ -241,13 +241,7 @@ public class Db {
         if (Objects.isNull(entity)) {
             return false;
         }
-        Class<T> entityClass = getEntityClass(entity);
-        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();
-        Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
-        Object idVal = tableInfo.getPropertyValue(entity, tableInfo.getKeyProperty());
-        return StringUtils.checkValNull(idVal) || Objects.isNull(getById((Serializable) idVal, entityClass)) ? save(entity) : updateById(entity);
+        return SqlHelper.execute(getEntityClass(entity), baseMapper -> baseMapper.saveOrUpdate(entity));
     }
 
     /**