防止表格最后页最后项删除变成暂无数据

This commit is contained in:
RuoYi 2021-09-02 10:19:04 +08:00
parent 57178e72a4
commit ee823b8326
17 changed files with 50 additions and 2 deletions

View File

@ -57,7 +57,8 @@ public class BaseController
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{ {
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy); Boolean reasonable = pageDomain.getReasonable();
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
} }
} }

View File

@ -21,6 +21,9 @@ public class PageDomain
/** 排序的方向desc或者asc */ /** 排序的方向desc或者asc */
private String isAsc = "asc"; private String isAsc = "asc";
/** 分页参数合理化 */
private Boolean reasonable = false;
public String getOrderBy() public String getOrderBy()
{ {
if (StringUtils.isEmpty(orderByColumn)) if (StringUtils.isEmpty(orderByColumn))
@ -81,4 +84,14 @@ public class PageDomain
this.isAsc = isAsc; this.isAsc = isAsc;
} }
} }
public Boolean getReasonable()
{
return reasonable;
}
public void setReasonable(Boolean reasonable)
{
this.reasonable = reasonable;
}
} }

View File

@ -29,6 +29,11 @@ public class TableSupport
*/ */
public static final String IS_ASC = "isAsc"; public static final String IS_ASC = "isAsc";
/**
* 分页参数合理化
*/
public static final String REASONABLE = "reasonable";
/** /**
* 封装分页对象 * 封装分页对象
*/ */
@ -39,6 +44,7 @@ public class TableSupport
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
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));
return pageDomain; return pageDomain;
} }

View File

@ -48,6 +48,22 @@ public class ServletUtils
return Convert.toInt(getRequest().getParameter(name), defaultValue); return Convert.toInt(getRequest().getParameter(name), defaultValue);
} }
/**
* 获取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 * 获取request
*/ */

View File

@ -320,6 +320,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
jobName: undefined, jobName: undefined,
jobGroup: undefined, jobGroup: undefined,
status: undefined status: undefined

View File

@ -220,6 +220,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
jobName: undefined, jobName: undefined,
jobGroup: undefined, jobGroup: undefined,
status: undefined status: undefined

View File

@ -153,6 +153,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
ipaddr: undefined, ipaddr: undefined,
userName: undefined, userName: undefined,
status: undefined status: undefined

View File

@ -219,6 +219,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
configName: undefined, configName: undefined,
configKey: undefined, configKey: undefined,
configType: undefined configType: undefined

View File

@ -247,6 +247,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: undefined status: undefined

View File

@ -227,6 +227,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: undefined status: undefined

View File

@ -204,6 +204,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
noticeTitle: undefined, noticeTitle: undefined,
createBy: undefined, createBy: undefined,
status: undefined status: undefined

View File

@ -192,6 +192,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
postCode: undefined, postCode: undefined,
postName: undefined, postName: undefined,
status: undefined status: undefined

View File

@ -128,6 +128,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
roleId: undefined, roleId: undefined,
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined

View File

@ -328,6 +328,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
roleName: undefined, roleName: undefined,
roleKey: undefined, roleKey: undefined,
status: undefined status: undefined

View File

@ -418,6 +418,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
userName: undefined, userName: undefined,
phonenumber: undefined, phonenumber: undefined,
status: undefined, status: undefined,

View File

@ -219,6 +219,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
reasonable: true,
tableName: undefined, tableName: undefined,
tableComment: undefined tableComment: undefined
}, },