diff --git a/docs/zh/base/batch.md b/docs/zh/base/batch.md index c9062474..55c0639a 100644 --- a/docs/zh/base/batch.md +++ b/docs/zh/base/batch.md @@ -69,10 +69,10 @@ Db.updateBatch(sql, new BatchArgsSetter() { 虽然这个方法叫 `updateBatch`,但一样可以执行 `insert`、`update` 等任何 SQL; 这个方法类似 Spring 的 `jdbcTemplate.batchUpdate()` 方法。 -## `Db.updateBatchEntity` 方法 +## `Db.updateEntitiesBatch` 方法 这个方法用于批量根据 id 更新 entity,其是对 `Db.executeBatch` 的封装,使用代码如下: ```java List accounts = .... -Db.updateBatchEntity(accounts, 1000); +Db.updateEntitiesBatch(accounts, 1000); ``` \ No newline at end of file diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Db.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Db.java index 8e98983d..c228ddd1 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Db.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Db.java @@ -278,7 +278,7 @@ public class Db { * @param batchSize 批次大小 * @return int */ - public static int updateBatchEntity(Collection entities, int batchSize) { + public static int updateEntitiesBatch(Collection entities, int batchSize) { List list = CollectionUtil.toList(entities); return Arrays.stream(executeBatch(list.size(), batchSize, RowMapper.class, (mapper, index) -> { T entity = list.get(index); @@ -292,8 +292,8 @@ public class Db { * @param entities 实体 * @return int 影响行数 */ - public static int updateBatchEntity(Collection entities) { - return updateBatchEntity(entities, RowMapper.DEFAULT_BATCH_SIZE); + public static int updateEntitiesBatch(Collection entities) { + return updateEntitiesBatch(entities, RowMapper.DEFAULT_BATCH_SIZE); } diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java index 9a3f2acf..4d0eb671 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java @@ -197,7 +197,7 @@ public interface RowMapper { * 更新 entity,主要用于进行批量更新的场景 * @param entity 实体类 * @see RowSqlProvider#updateEntity(Map) - * @see Db#updateBatchEntity(Collection, int) + * @see Db#updateEntitiesBatch(Collection, int) */ @UpdateProvider(value = RowSqlProvider.class, method = "updateEntity") int updateEntity(@Param(FlexConsts.ENTITY) Object entity);