TableSupport.java 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.bizmatics.model.page;
  2. import com.bizmatics.common.mvc.utils.ServletUtils;
  3. /**
  4. * 表格数据处理
  5. */
  6. public class TableSupport {
  7. /**
  8. * 当前记录起始索引
  9. */
  10. public static final String PAGE_NUM = "pageNum";
  11. /**
  12. * 每页显示记录数
  13. */
  14. public static final String PAGE_SIZE = "pageSize";
  15. /**
  16. * 排序列
  17. */
  18. public static final String ORDER_BY_COLUMN = "orderByColumn";
  19. /**
  20. * 排序的方向 "desc" 或者 "asc".
  21. */
  22. public static final String IS_ASC = "isAsc";
  23. /**
  24. * 封装分页对象
  25. */
  26. public static PageDomain getPageDomain() {
  27. PageDomain pageDomain = new PageDomain();
  28. pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM));
  29. pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
  30. pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
  31. pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
  32. return pageDomain;
  33. }
  34. public static PageDomain buildPageRequest() {
  35. return getPageDomain();
  36. }
  37. }