diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index 3c26de52a..5b450cb87 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -57,7 +57,8 @@ public class BaseController 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); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java index b9d5e6e4c..e98fa4119 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java @@ -21,6 +21,9 @@ public class PageDomain /** 排序的方向desc或者asc */ private String isAsc = "asc"; + /** 分页参数合理化 */ + private Boolean reasonable = false; + public String getOrderBy() { if (StringUtils.isEmpty(orderByColumn)) @@ -81,4 +84,14 @@ public class PageDomain this.isAsc = isAsc; } } + + public Boolean getReasonable() + { + return reasonable; + } + + public void setReasonable(Boolean reasonable) + { + this.reasonable = reasonable; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java index 511e24b8d..03d0ce57b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java @@ -29,6 +29,11 @@ public class TableSupport */ 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.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); + pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); return pageDomain; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java index 9e6fd59a2..a10c8edb6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java @@ -48,6 +48,22 @@ public class ServletUtils 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 */ diff --git a/ruoyi-ui/src/api/login.js b/ruoyi-ui/src/api/login.js index 1113abe3a..224561606 100644 --- a/ruoyi-ui/src/api/login.js +++ b/ruoyi-ui/src/api/login.js @@ -48,6 +48,6 @@ export function getCodeImg() { return request({ url: '/captchaImage', method: 'get', - timeout: 20000 + timeout: 20000 }) } \ No newline at end of file diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 614663358..c4210972a 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -320,6 +320,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, jobName: undefined, jobGroup: undefined, status: undefined diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index b55b01150..64216f3d8 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -220,6 +220,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, jobName: undefined, jobGroup: undefined, status: undefined diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index 59df72ce0..14921e528 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -153,6 +153,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, ipaddr: undefined, userName: undefined, status: undefined diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index b8472a802..f8b940c57 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -219,6 +219,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, configName: undefined, configKey: undefined, configType: undefined diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index aa3849a62..f1ba191c8 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -247,6 +247,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, dictName: undefined, dictType: undefined, status: undefined diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index 20cf5ce97..97c810069 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -227,6 +227,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, dictName: undefined, dictType: undefined, status: undefined diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index 7b4eb2d06..143408c0f 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -204,6 +204,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, noticeTitle: undefined, createBy: undefined, status: undefined diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 10eca78a8..278475605 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -192,6 +192,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, postCode: undefined, postName: undefined, status: undefined diff --git a/ruoyi-ui/src/views/system/role/authUser.vue b/ruoyi-ui/src/views/system/role/authUser.vue index a65ccbf6e..51edd3322 100644 --- a/ruoyi-ui/src/views/system/role/authUser.vue +++ b/ruoyi-ui/src/views/system/role/authUser.vue @@ -128,6 +128,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, roleId: undefined, userName: undefined, phonenumber: undefined diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 27167c9db..0e92231a0 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -328,6 +328,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, roleName: undefined, roleKey: undefined, status: undefined diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 460740924..5e8aed181 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -418,6 +418,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, userName: undefined, phonenumber: undefined, status: undefined, diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index 188b071c2..ab75b5392 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -219,6 +219,7 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + reasonable: true, tableName: undefined, tableComment: undefined },