标题: ipage【mybatis-plus】转page【org.springframework.data.domain.Page】, ipage转page分页total总数量错误。
实现转换代码:
public static <D> Page<D> getPage(IPage<D> page) {
Pageable pageable = PageRequest.of((int)page.getCurrent()-1, (int)page.getSize());
return new PageImpl<D>(page.getRecords(), pageable, page.getTotal());
}
问题有时候会爆出total总数量变化:源码展示
/**
* Constructor of {@code PageImpl}.
*
* @param content the content of this page, must not be {@literal null}.
* @param pageable the paging information, must not be {@literal null}.
* @param total the total amount of items available. The total might be adapted considering the length of the content
* given, if it is going to be the content of the last page. This is in place to mitigate inconsistencies.
*/
public PageImpl(List<T> content, Pageable pageable, long total) {
super(