|
@@ -1,6 +1,8 @@
|
|
|
package com.yonge.cooleshow.biz.dal.dto;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -54,15 +56,29 @@ public class PageUtil {
|
|
|
return resultPage;
|
|
|
}
|
|
|
|
|
|
- public static <T,E> com.microsvc.toolkit.common.response.paging.PageInfo<T> transPageInfo(PageInfo<E> source, List<T> rows) {
|
|
|
+ public static <T,E> IPage<T> transPageInfo(IPage<E> source, List<T> rows) {
|
|
|
if (Objects.isNull(source)) {
|
|
|
- return new com.microsvc.toolkit.common.response.paging.PageInfo<>();
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ int total = Integer.parseInt(String.valueOf(source.getTotal()));
|
|
|
+ int limit = Integer.parseInt(String.valueOf(source.getSize()));
|
|
|
+ IPage<T> resultPage = new Page<>();
|
|
|
+ resultPage.setRecords(rows);
|
|
|
+ resultPage.setCurrent(Long.valueOf(source.getCurrent()).intValue());
|
|
|
+ resultPage.setSize(limit);
|
|
|
+ resultPage.setTotal(total);
|
|
|
+ return resultPage;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static <T,E> PageInfo<T> transPageInfo(PageInfo<E> source, List<T> rows) {
|
|
|
+ if (Objects.isNull(source)) {
|
|
|
+ return new PageInfo<>();
|
|
|
}
|
|
|
int total = Integer.parseInt(String.valueOf(source.getTotal()));
|
|
|
int limit = Integer.parseInt(String.valueOf(source.getLimit()));
|
|
|
- com.microsvc.toolkit.common.response.paging.PageInfo<T> resultPage = new com.microsvc.toolkit.common.response.paging.PageInfo<>();
|
|
|
+ PageInfo<T> resultPage = new PageInfo<>();
|
|
|
resultPage.setRows(rows);
|
|
|
- resultPage.setCurrent(Long.valueOf(source.getPageNo()).intValue());
|
|
|
+ resultPage.setPageNo(Long.valueOf(source.getPageNo()).intValue());
|
|
|
resultPage.setLimit(limit);
|
|
|
resultPage.setTotal(total);
|
|
|
return resultPage;
|