Skip to content

Commit

Permalink
feat: Add insertBatch method to BaseMapperX
Browse files Browse the repository at this point in the history
  • Loading branch information
xooooooooox committed Dec 26, 2024
1 parent f2d4c29 commit eab0aa8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChangeLog

## 0.3

-

## 0.2

### features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ default PageResult<T> selectPage(PageParam pageParam, List<SortingField> sorting
// ================================ Join ============================== //

default <D> PageResult<D> selectJoinPage(PageParam pageParam, Class<D> clazz, MPJLambdaWrapper<T> lambdaWrapper) {
if (pageParam.getPageSize().equals(PageParam.PAGE_SIZE_NONE)){
if (pageParam.getPageSize().equals(PageParam.PAGE_SIZE_NONE)) {
List<D> totalList = selectJoinList(clazz, lambdaWrapper);
return PageResult.build(totalList, (long) totalList.size());
}
Expand Down Expand Up @@ -158,4 +158,15 @@ default int delete(String field, String value) {
default int delete(SFunction<T, ?> field, Object value) {
return delete(new LambdaQueryWrapper<T>().eq(field, value));
}

/**
* 批量插入
*
* @param collections 待插入的数据列表
* @param size 插入数量, {@link Db#saveBatch} 默认为 1000
* @return 操作成功或失败
*/
default Boolean insertBatch(Collection<T> collections, int size) {
return Db.saveBatch(collections, size);
}
}

0 comments on commit eab0aa8

Please sign in to comment.