设置分页参数默认值
This commit is contained in:
parent
2a9beec31d
commit
b42a8176ca
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.common.core.page;
|
package com.ruoyi.common.core.page;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,8 +41,8 @@ public class TableSupport
|
||||||
public static PageDomain getPageDomain()
|
public static PageDomain getPageDomain()
|
||||||
{
|
{
|
||||||
PageDomain pageDomain = new PageDomain();
|
PageDomain pageDomain = new PageDomain();
|
||||||
pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM));
|
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||||
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
|
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||||
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||||
|
|
|
@ -20,13 +20,10 @@ public class PageUtils extends PageHelper
|
||||||
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());
|
||||||
Boolean reasonable = pageDomain.getReasonable();
|
Boolean reasonable = pageDomain.getReasonable();
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理分页的线程变量
|
* 清理分页的线程变量
|
||||||
|
|
Loading…
Reference in New Issue