mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-22 21:39:01 +08:00
update 优化 代码
This commit is contained in:
@@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
@@ -27,12 +27,23 @@ public class PageResult<T> implements Serializable {
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
private List<T> rows;
|
||||
private Collection<T> rows;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public PageResult(Collection<T> list, long total) {
|
||||
this.rows = list;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分页对象构建表格分页数据对象
|
||||
*/
|
||||
public static <T> PageResult<T> build(List<T> list, long total) {
|
||||
public static <T> PageResult<T> build(Collection<T> list, long total) {
|
||||
PageResult<T> rspData = new PageResult<>();
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(total);
|
||||
@@ -42,7 +53,7 @@ public class PageResult<T> implements Serializable {
|
||||
/**
|
||||
* 根据数据列表构建表格分页数据对象
|
||||
*/
|
||||
public static <T> PageResult<T> build(List<T> list) {
|
||||
public static <T> PageResult<T> build(Collection<T> list) {
|
||||
PageResult<T> rspData = new PageResult<>();
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(list.size());
|
||||
|
||||
Reference in New Issue
Block a user