懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 package com.jcdm.common.core.page;
2
3 import com.jcdm.common.core.text.Convert;
4 import com.jcdm.common.utils.ServletUtils;
5
6 /**
7  * 表格数据处理
8  * 
9  * @author jc
10  */
11 public class TableSupport
12 {
13     /**
14      * 当前记录起始索引
15      */
16     public static final String PAGE_NUM = "pageNum";
17
18     /**
19      * 每页显示记录数
20      */
21     public static final String PAGE_SIZE = "pageSize";
22
23     /**
24      * 排序列
25      */
26     public static final String ORDER_BY_COLUMN = "orderByColumn";
27
28     /**
29      * 排序的方向 "desc" 或者 "asc".
30      */
31     public static final String IS_ASC = "isAsc";
32
33     /**
34      * 分页参数合理化
35      */
36     public static final String REASONABLE = "reasonable";
37
38     /**
39      * 封装分页对象
40      */
41     public static PageDomain getPageDomain()
42     {
43         PageDomain pageDomain = new PageDomain();
44         pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
45         pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
46         pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
47         pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
48         pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
49         return pageDomain;
50     }
51
52     public static PageDomain buildPageRequest()
53     {
54         return getPageDomain();
55     }
56 }