| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 获取Boolean参数
|
| | | */
|
| | | public static Boolean getParameterToBool(String name)
|
| | | {
|
| | | return Convert.toBool(getRequest().getParameter(name));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取Boolean参数
|
| | | */
|
| | | public static Boolean getParameterToBool(String name, Boolean defaultValue)
|
| | | {
|
| | | return Convert.toBool(getRequest().getParameter(name), defaultValue);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取request
|
| | | */
|
| | | public static HttpServletRequest getRequest()
|
| | |
| | | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
| | | {
|
| | | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
| | | PageHelper.startPage(pageNum, pageSize, orderBy);
|
| | | Boolean reasonable = pageDomain.getReasonable();
|
| | | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | /** 排序的方向desc或者asc */
|
| | | private String isAsc = "asc";
|
| | |
|
| | | /** 分页参数合理化 */
|
| | | private Boolean reasonable = false;
|
| | |
|
| | | public String getOrderBy()
|
| | | {
|
| | | if (StringUtils.isEmpty(orderByColumn))
|
| | |
| | | this.isAsc = isAsc;
|
| | | }
|
| | | }
|
| | |
|
| | | public Boolean getReasonable()
|
| | | {
|
| | | return reasonable;
|
| | | }
|
| | |
|
| | | public void setReasonable(Boolean reasonable)
|
| | | {
|
| | | this.reasonable = reasonable;
|
| | | }
|
| | | }
|
| | |
| | | public static final String IS_ASC = "isAsc";
|
| | |
|
| | | /**
|
| | | * 分页参数合理化
|
| | | */
|
| | | public static final String REASONABLE = "reasonable";
|
| | |
|
| | | /**
|
| | | * 封装分页对象
|
| | | */
|
| | | public static PageDomain getPageDomain()
|
| | |
| | | pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
|
| | | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
| | | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
| | | pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
| | | return pageDomain;
|
| | | }
|
| | |
|