Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
7492dcc9
Commit
7492dcc9
authored
Dec 18, 2021
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
请求分页方法设置成通用方便灵活调用
parent
8978012f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
9 deletions
+31
-9
BaseController.java
...java/com/ruoyi/common/core/controller/BaseController.java
+2
-9
PageUtils.java
...ommon/src/main/java/com/ruoyi/common/utils/PageUtils.java
+29
-0
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
View file @
7492dcc9
...
...
@@ -16,6 +16,7 @@ import com.ruoyi.common.core.page.PageDomain;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.core.page.TableSupport
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.PageUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.sql.SqlUtil
;
...
...
@@ -51,15 +52,7 @@ public class BaseController
*/
protected
void
startPage
()
{
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
Integer
pageNum
=
pageDomain
.
getPageNum
();
Integer
pageSize
=
pageDomain
.
getPageSize
();
if
(
StringUtils
.
isNotNull
(
pageNum
)
&&
StringUtils
.
isNotNull
(
pageSize
))
{
String
orderBy
=
SqlUtil
.
escapeOrderBySql
(
pageDomain
.
getOrderBy
());
Boolean
reasonable
=
pageDomain
.
getReasonable
();
PageHelper
.
startPage
(
pageNum
,
pageSize
,
orderBy
).
setReasonable
(
reasonable
);
}
PageUtils
.
startPage
();
}
/**
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
0 → 100644
View file @
7492dcc9
package
com
.
ruoyi
.
common
.
utils
;
import
com.github.pagehelper.PageHelper
;
import
com.ruoyi.common.core.page.PageDomain
;
import
com.ruoyi.common.core.page.TableSupport
;
import
com.ruoyi.common.utils.sql.SqlUtil
;
/**
* 分页工具类
*
* @author ruoyi
*/
public
class
PageUtils
extends
PageHelper
{
/**
* 设置请求分页数据
*/
public
static
void
startPage
()
{
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
Integer
pageNum
=
pageDomain
.
getPageNum
();
Integer
pageSize
=
pageDomain
.
getPageSize
();
if
(
StringUtils
.
isNotNull
(
pageNum
)
&&
StringUtils
.
isNotNull
(
pageSize
))
{
String
orderBy
=
SqlUtil
.
escapeOrderBySql
(
pageDomain
.
getOrderBy
());
PageHelper
.
startPage
(
pageNum
,
pageSize
,
orderBy
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment