2026-04-17 10:09:03 +08:00
|
|
|
package com.maibu.utils;
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.maibu.core.page.PageDomain;
|
|
|
|
|
import com.maibu.core.page.TableSupport;
|
|
|
|
|
import com.maibu.utils.sql.SqlUtil;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页工具类
|
|
|
|
|
*
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
*/
|
2026-06-11 17:12:55 +08:00
|
|
|
public class PageUtils extends PageHelper {
|
2026-04-17 10:09:03 +08:00
|
|
|
/**
|
|
|
|
|
* 设置请求分页数据
|
|
|
|
|
*/
|
2026-06-11 17:12:55 +08:00
|
|
|
public static void startPage() {
|
2026-04-17 10:09:03 +08:00
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
|
|
Integer pageNum = pageDomain.getPageNum();
|
|
|
|
|
Integer pageSize = pageDomain.getPageSize();
|
|
|
|
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
|
|
|
Boolean reasonable = pageDomain.getReasonable();
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 清理分页的线程变量
|
|
|
|
|
*/
|
2026-06-11 17:12:55 +08:00
|
|
|
public static void clearPage() {
|
2026-04-17 10:09:03 +08:00
|
|
|
PageHelper.clearPage();
|
|
|
|
|
}
|
|
|
|
|
}
|