提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.common.utils; |
懒 |
2 |
|
|
3 |
import com.github.pagehelper.PageHelper; |
|
4 |
import com.jcdm.common.core.page.PageDomain; |
|
5 |
import com.jcdm.common.core.page.TableSupport; |
|
6 |
import com.jcdm.common.utils.sql.SqlUtil; |
|
7 |
|
|
8 |
/** |
|
9 |
* 分页工具类 |
|
10 |
* |
|
11 |
* @author jc |
|
12 |
*/ |
|
13 |
public class PageUtils extends PageHelper |
|
14 |
{ |
|
15 |
/** |
|
16 |
* 设置请求分页数据 |
|
17 |
*/ |
|
18 |
public static void startPage() |
|
19 |
{ |
|
20 |
PageDomain pageDomain = TableSupport.buildPageRequest(); |
|
21 |
Integer pageNum = pageDomain.getPageNum(); |
|
22 |
Integer pageSize = pageDomain.getPageSize(); |
|
23 |
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); |
|
24 |
Boolean reasonable = pageDomain.getReasonable(); |
|
25 |
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); |
|
26 |
} |
|
27 |
|
|
28 |
/** |
|
29 |
* 清理分页的线程变量 |
|
30 |
*/ |
|
31 |
public static void clearPage() |
|
32 |
{ |
|
33 |
PageHelper.clearPage(); |
|
34 |
} |
|
35 |
} |