You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
961 B
38 lines
961 B
package com.mh.common.utils; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
import com.mh.common.core.page.PageDomain; |
|
import com.mh.common.core.page.TableSupport; |
|
import com.mh.common.utils.sql.SqlUtil; |
|
|
|
/** |
|
* 分页工具类 |
|
* |
|
* @author mh |
|
*/ |
|
public class PageUtils extends PageHelper |
|
{ |
|
/** |
|
* 设置请求分页数据 |
|
*/ |
|
public static void startPage() |
|
{ |
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
Integer pageNum = pageDomain.getPageNum(); |
|
if (pageNum == 0) { |
|
return; |
|
} |
|
Integer pageSize = pageDomain.getPageSize(); |
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); |
|
Boolean reasonable = pageDomain.getReasonable(); |
|
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); |
|
} |
|
|
|
/** |
|
* 清理分页的线程变量 |
|
*/ |
|
public static void clearPage() |
|
{ |
|
PageHelper.clearPage(); |
|
} |
|
}
|
|
|