Revert "增加分页参数默认值,防止传空时查询全表"

This reverts commit 99e7820bc7.
This commit is contained in:
wsy 2020-09-25 09:43:58 +08:00
parent be3f3dd55e
commit 4f2a32e733
3 changed files with 7 additions and 14 deletions

View File

@ -52,21 +52,11 @@ public class Constants
*/ */
public static final String PAGE_NUM = "pageNum"; public static final String PAGE_NUM = "pageNum";
/**
* 当前记录起始索引默认值
*/
public static final int PAGE_NUM_DEFAULT_VALUE = 1;
/** /**
* 每页显示记录数 * 每页显示记录数
*/ */
public static final String PAGE_SIZE = "pageSize"; public static final String PAGE_SIZE = "pageSize";
/**
* 每页显示记录数默认值
*/
public static final int PAGE_SIZE_DEFAULT_VALUE = 10;
/** /**
* 排序列 * 排序列
*/ */

View File

@ -56,9 +56,12 @@ public class BaseController
PageDomain pageDomain = TableSupport.buildPageRequest(); PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum(); Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize(); Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy); PageHelper.startPage(pageNum, pageSize, orderBy);
} }
}
/** /**
* 设置请求排序数据 * 设置请求排序数据

View File

@ -16,8 +16,8 @@ public class TableSupport
public static PageDomain getPageDomain() public static PageDomain getPageDomain()
{ {
PageDomain pageDomain = new PageDomain(); PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM, Constants.PAGE_NUM_DEFAULT_VALUE)); pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE, Constants.PAGE_SIZE_DEFAULT_VALUE)); pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDER_BY_COLUMN)); pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDER_BY_COLUMN));
pageDomain.setIsAsc(ServletUtils.getParameter(Constants.IS_ASC)); pageDomain.setIsAsc(ServletUtils.getParameter(Constants.IS_ASC));
return pageDomain; return pageDomain;