Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
69a03df0
Commit
69a03df0
authored
Aug 29, 2019
by
qiuweili123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化分页对象
parent
5669ff52
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletions
+22
-1
BeanUtil.java
common-util/src/main/java/com/secoo/mall/common/util/bean/BeanUtil.java
+3
-1
DataPage.java
mybatis-starter/src/main/java/com/secoo/mall/mybatis/bean/DataPage.java
+11
-0
PageUtil.java
mybatis-starter/src/main/java/com/secoo/mall/mybatis/util/PageUtil.java
+8
-0
No files found.
common-util/src/main/java/com/secoo/mall/common/util/bean/BeanUtil.java
View file @
69a03df0
...
@@ -36,7 +36,9 @@ public class BeanUtil extends BeanUtils {
...
@@ -36,7 +36,9 @@ public class BeanUtil extends BeanUtils {
return
Maps
.
newHashMapWithExpectedSize
(
0
);
return
Maps
.
newHashMapWithExpectedSize
(
0
);
}
}
try
{
try
{
return
PropertyUtils
.
describe
(
object
);
Map
<
String
,
Object
>
dataMap
=
PropertyUtils
.
describe
(
object
);
dataMap
.
remove
(
"class"
);
return
dataMap
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
SystemInternalException
();
throw
new
SystemInternalException
();
}
}
...
...
mybatis-starter/src/main/java/com/secoo/mall/mybatis/bean/DataPage.java
View file @
69a03df0
...
@@ -2,11 +2,14 @@ package com.secoo.mall.mybatis.bean;
...
@@ -2,11 +2,14 @@ package com.secoo.mall.mybatis.bean;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.secoo.mall.common.core.bean.Pageable
;
import
com.secoo.mall.common.core.bean.Pageable
;
import
com.secoo.mall.common.util.colletion.CollectionUtil
;
import
java.util.List
;
import
java.util.List
;
public
class
DataPage
<
T
>
implements
Pageable
<
T
>
{
public
class
DataPage
<
T
>
implements
Pageable
<
T
>
{
private
List
dataList
;
private
Page
<
T
>
page
;
private
Page
<
T
>
page
;
public
DataPage
(
Page
<
T
>
page
)
{
public
DataPage
(
Page
<
T
>
page
)
{
...
@@ -15,6 +18,9 @@ public class DataPage<T> implements Pageable<T> {
...
@@ -15,6 +18,9 @@ public class DataPage<T> implements Pageable<T> {
@Override
@Override
public
List
<
T
>
getResultList
()
{
public
List
<
T
>
getResultList
()
{
if
(
CollectionUtil
.
isNotEmpty
(
dataList
))
{
return
dataList
;
}
return
page
.
getRecords
();
return
page
.
getRecords
();
}
}
...
@@ -32,4 +38,9 @@ public class DataPage<T> implements Pageable<T> {
...
@@ -32,4 +38,9 @@ public class DataPage<T> implements Pageable<T> {
public
Long
getPageSize
()
{
public
Long
getPageSize
()
{
return
page
.
getSize
();
return
page
.
getSize
();
}
}
public
void
setDataList
(
List
dataList
)
{
this
.
dataList
=
dataList
;
}
}
}
mybatis-starter/src/main/java/com/secoo/mall/mybatis/util/PageUtil.java
View file @
69a03df0
...
@@ -6,6 +6,7 @@ import com.secoo.mall.common.constant.PageConstant;
...
@@ -6,6 +6,7 @@ import com.secoo.mall.common.constant.PageConstant;
import
com.secoo.mall.common.core.bean.ReqPage
;
import
com.secoo.mall.common.core.bean.ReqPage
;
import
com.secoo.mall.common.core.bean.Sort
;
import
com.secoo.mall.common.core.bean.Sort
;
import
com.secoo.mall.common.core.exception.ParameterException
;
import
com.secoo.mall.common.core.exception.ParameterException
;
import
com.secoo.mall.common.util.colletion.CollectionUtil
;
import
com.secoo.mall.common.util.string.StringUtil
;
import
com.secoo.mall.common.util.string.StringUtil
;
import
com.secoo.mall.mybatis.bean.DataPage
;
import
com.secoo.mall.mybatis.bean.DataPage
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -73,5 +74,12 @@ public interface PageUtil {
...
@@ -73,5 +74,12 @@ public interface PageUtil {
}
}
}
}
static
void
setResultList
(
DataPage
dataPage
,
List
dataList
)
{
if
(
CollectionUtil
.
isEmpty
(
dataList
))
{
dataList
=
new
ArrayList
();
}
dataPage
.
setDataList
(
dataList
);
}
}
}
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