Commit 318d6e38 by jhrabal

page

parent d441551c
...@@ -172,7 +172,6 @@ ...@@ -172,7 +172,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
</plugin> </plugin>
<plugin> <plugin>
...@@ -188,7 +187,6 @@ ...@@ -188,7 +187,6 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version><!--$NO-MVN-MAN-VER$--> <version>3.8.0</version><!--$NO-MVN-MAN-VER$-->
<configuration> <configuration>
<release>${java.version}</release>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
......
...@@ -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(), pagesCount, c.list(), pagingInfo.getField(), pagingInfo.getTrend()); return new Page<>(pagingInfo.getPage(), pagesCount, count, c.list(), pagingInfo.getField(), pagingInfo.getTrend());
} }
......
...@@ -7,6 +7,8 @@ package com.jh.boot.web.list; ...@@ -7,6 +7,8 @@ package com.jh.boot.web.list;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.jh.tsk.model.Contractor;
/** /**
* TODO. * TODO.
* *
...@@ -30,6 +32,8 @@ public class Page<T> { ...@@ -30,6 +32,8 @@ public class Page<T> {
/** The trend. */ /** The trend. */
private SortTrend trend; private SortTrend trend;
private int totalElements;
/** /**
* Instantiates a new page. * Instantiates a new page.
* *
...@@ -70,6 +74,16 @@ public class Page<T> { ...@@ -70,6 +74,16 @@ public class Page<T> {
this.trend = trend; this.trend = trend;
} }
public Page(int page, int pagesCount, int totalElementsCount, List<T> content, String sortBy, SortTrend trend) {
super();
this.content = content;
this.pagesCount = pagesCount;
this.totalElements = totalElementsCount;
this.page = page;
this.sortBy = sortBy;
this.trend = trend;
}
/** /**
* Gets the content. * Gets the content.
* *
...@@ -123,4 +137,13 @@ public class Page<T> { ...@@ -123,4 +137,13 @@ public class Page<T> {
public boolean isSorted() { public boolean isSorted() {
return sortBy != null && trend != null; return sortBy != null && trend != null;
} }
public int getTotalElements() {
return totalElements;
}
public static <T> Page<T> empty() {
return new Page<T>(0, 0, Collections.emptyList());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment