PageHelper
This commit is contained in:
@@ -47,6 +47,20 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>sqlparser4.5</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.czg.utils;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -77,4 +78,17 @@ public class PageUtil {
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* pageHelper 转为 mybatisflex 分页
|
||||
*/
|
||||
public static <T> Page<T> convert(PageInfo<T> page) {
|
||||
Page<T> page1 = new Page<>();
|
||||
page1.setPageNumber(page.getPageNum());
|
||||
page1.setPageSize(page.getPageSize());
|
||||
page1.setTotalRow(page.getTotal());
|
||||
page1.setTotalPage(page.getPages());
|
||||
page1.setRecords(page.getList());
|
||||
return page1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user