Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Easy-Es是一款简化ElasticSearch搜索引擎操作的开源框架,全自动

- [Switch To English](https://gitee.com/easy-es/easy-es/blob/master/README_EN.md)
- [功能示例](https://gitee.com/dromara/easy-es/tree/master/easy-es-sample)
- [Springboot集成Demo](https://www.easy-es.cn/pages/12283a/)
- [Springboot集成Demo](https://www.easy-es.cn/pages/e12389/)

# Latest Version: [![Maven Central](https://img.shields.io/github/v/release/xpc1024/easy-es?include_prereleases&logo=xpc&style=plastic)](https://search.maven.org/search?q=g:io.github.xpc1024%20a:easy-*)

Expand Down
17 changes: 17 additions & 0 deletions easy-es-core/src/main/java/cn/easyes/core/biz/EsPageInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

import static java.util.stream.Collectors.toList;

/**
* 分页参数 来源:https://github.com/pagehelper/Mybatis-PageHelper
Expand Down Expand Up @@ -118,6 +121,20 @@ public static <T> EsPageInfo<T> of(List<T> list, int navigatePages) {
return new EsPageInfo<T>(list, navigatePages);
}

/**
* EsPageInfo 的泛型转换
*
* @param mapper 转换函数
* @param <R> 转换后的泛型
* @return 转换泛型后的 EsPageInfo
*/
@SuppressWarnings("unchecked")
public <R> EsPageInfo<R> convert(Function<? super T, ? extends R> mapper) {
List<R> collect = this.getList().stream().map(mapper).collect(toList());
((EsPageInfo<R>) this).setList(collect);
return (EsPageInfo<R>) this;
}

/**
* 计算导航页
*/
Expand Down