重构。

This commit is contained in:
2023-02-24 11:10:27 +08:00
parent 3a4a9c5166
commit 2c4c9069c6
13 changed files with 82 additions and 82 deletions

View 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;
}
}