forked from plusone/plusone-commons
重构。
This commit is contained in:
40
src/main/java/xyz/zhouxy/plusone/commons/util/PageDTO.java
Normal file
40
src/main/java/xyz/zhouxy/plusone/commons/util/PageDTO.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package xyz.zhouxy.plusone.commons.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 返回分页查询的结果
|
||||
*
|
||||
* @param <T> 内容列表的元素类型
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @see PagingAndSortingQueryParams
|
||||
*/
|
||||
@ToString
|
||||
@Setter
|
||||
public class PageDTO<T> {
|
||||
|
||||
private Long total;
|
||||
private List<T> content;
|
||||
|
||||
private PageDTO(List<T> content, Long total) {
|
||||
this.content = content;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public static <T> PageDTO<T> of(List<T> content, Long total) {
|
||||
return new PageDTO<>(content, total);
|
||||
}
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public List<T> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user