Files
thewindminer/src/main/java/com/jxy/windminer/common/utils/PageUtils.java

37 lines
942 B
Java
Raw Normal View History

2026-01-15 17:29:12 +08:00
package com.jxy.windminer.common.utils;
import com.github.pagehelper.PageHelper;
import com.jxy.windminer.common.utils.sql.SqlUtil;
import com.jxy.windminer.common.web.page.Page;
import com.jxy.windminer.common.web.page.TableSupport;
/**
* @Description 分页工具类
* @Date 2022/5/10 14:37
* @Author 杜懿
*/
public class PageUtils extends PageHelper
{
/**
* 设置请求分页数据
*/
public static void startPage()
{
Page page = TableSupport.buildPageRequest();
Integer pageNum = page.getPageNum();
Integer pageSize = page.getPageSize();
String orderBy = SqlUtil.escapeOrderBySql(page.getOrderBy());
Boolean reasonable = page.getReasonable();
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
}
/**
* 清理分页的线程变量
*/
public static void clearPage()
{
PageHelper.clearPage();
}
}