Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jh-boot
Project
Overview
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
Jan Hrabal
jh-boot
Commits
dbda556e
Commit
dbda556e
authored
Sep 21, 2019
by
Jan Hrabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small paging improvements
parent
1949ff93
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
7 deletions
+34
-7
AbstractHibernateRepository.java
...ain/java/com/jh/boot/jpa/AbstractHibernateRepository.java
+1
-1
DefaultSorting.java
src/main/java/com/jh/boot/web/list/DefaultSorting.java
+0
-0
ListHelper.java
src/main/java/com/jh/boot/web/list/ListHelper.java
+2
-2
Page.java
src/main/java/com/jh/boot/web/list/Page.java
+2
-2
SortTrend.java
src/main/java/com/jh/boot/web/list/SortTrend.java
+29
-2
No files found.
src/main/java/com/jh/boot/jpa/AbstractHibernateRepository.java
View file @
dbda556e
...
@@ -149,7 +149,7 @@ public abstract class AbstractHibernateRepository {
...
@@ -149,7 +149,7 @@ public abstract class AbstractHibernateRepository {
sortedCriteria
(
c
,
pagingInfo
);
sortedCriteria
(
c
,
pagingInfo
);
return
new
Page
<>(
pagingInfo
.
getPage
(),
pag
ingInfo
.
getPageSize
(),
pagesCount
,
count
,
c
.
list
(),
pagingInfo
.
getField
(),
pagingInfo
.
getTrend
());
return
new
Page
<>(
pagingInfo
.
getPage
(),
pag
esCount
,
pagingInfo
.
getPageSize
()
,
count
,
c
.
list
(),
pagingInfo
.
getField
(),
pagingInfo
.
getTrend
());
}
}
...
...
src/main/java/com/jh/boot/web/list/DefaultSorting.java
View file @
dbda556e
src/main/java/com/jh/boot/web/list/ListHelper.java
View file @
dbda556e
...
@@ -94,12 +94,12 @@ public class ListHelper {
...
@@ -94,12 +94,12 @@ public class ListHelper {
field
=
defaultField
;
field
=
defaultField
;
}
}
if
(
trend
==
null
)
{
if
(
!
StringUtils
.
hasText
(
trend
)
)
{
if
(
defaultTrend
!=
null
)
{
if
(
defaultTrend
!=
null
)
{
st
=
defaultTrend
;
st
=
defaultTrend
;
}
}
}
else
{
}
else
{
st
=
"desc"
.
equalsIgnoreCase
(
trend
)
?
SortTrend
.
DESCENDING
:
SortTrend
.
ASCENDING
;
st
=
SortTrend
.
parse
(
trend
)
;
}
}
if
(!
StringUtils
.
hasText
(
field
)
||
st
==
null
)
{
if
(!
StringUtils
.
hasText
(
field
)
||
st
==
null
)
{
...
...
src/main/java/com/jh/boot/web/list/Page.java
View file @
dbda556e
...
@@ -128,8 +128,8 @@ public class Page<T> {
...
@@ -128,8 +128,8 @@ public class Page<T> {
*
*
* @return the trend
* @return the trend
*/
*/
public
S
ortTrend
getTrend
()
{
public
S
tring
getTrend
()
{
return
trend
;
return
trend
==
null
?
null
:
trend
.
getTrend
()
;
}
}
/**
/**
...
...
src/main/java/com/jh/boot/web/list/SortTrend.java
View file @
dbda556e
...
@@ -12,7 +12,34 @@ package com.jh.boot.web.list;
...
@@ -12,7 +12,34 @@ package com.jh.boot.web.list;
public
enum
SortTrend
{
public
enum
SortTrend
{
/** The ascending. */
/** The ascending. */
ASCENDING
,
ASCENDING
(
"asc"
),
/** The descending. */
/** The descending. */
DESCENDING
DESCENDING
(
"desc"
);
private
String
trend
;
private
SortTrend
(
String
trend
)
{
this
.
trend
=
trend
;
}
public
String
getTrend
()
{
return
trend
;
}
@Override
public
String
toString
()
{
return
trend
;
}
public
static
SortTrend
parse
(
String
s
)
{
for
(
SortTrend
st
:
values
())
{
if
(
st
.
trend
.
equalsIgnoreCase
(
s
)
||
st
.
name
().
equalsIgnoreCase
(
s
))
{
return
st
;
}
}
return
null
;
}
}
}
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