提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.framework.common.pojo; |
H |
2 |
|
|
3 |
import io.swagger.v3.oas.annotations.media.Schema; |
|
4 |
import lombok.Data; |
|
5 |
|
|
6 |
import java.io.Serializable; |
|
7 |
import java.util.ArrayList; |
|
8 |
import java.util.List; |
|
9 |
|
|
10 |
@Schema(description = "分页结果") |
|
11 |
@Data |
|
12 |
public final class PageResult<T> implements Serializable { |
|
13 |
|
|
14 |
@Schema(description = "数据", requiredMode = Schema.RequiredMode.REQUIRED) |
|
15 |
private List<T> list; |
|
16 |
|
|
17 |
@Schema(description = "总量", requiredMode = Schema.RequiredMode.REQUIRED) |
|
18 |
private Long total; |
|
19 |
|
|
20 |
public PageResult() { |
|
21 |
} |
|
22 |
|
|
23 |
public PageResult(List<T> list, Long total) { |
|
24 |
this.list = list; |
|
25 |
this.total = total; |
|
26 |
} |
|
27 |
|
|
28 |
public PageResult(Long total) { |
|
29 |
this.list = new ArrayList<>(); |
|
30 |
this.total = total; |
|
31 |
} |
|
32 |
|
|
33 |
public static <T> PageResult<T> empty() { |
|
34 |
return new PageResult<>(0L); |
|
35 |
} |
|
36 |
|
|
37 |
public static <T> PageResult<T> empty(Long total) { |
|
38 |
return new PageResult<>(total); |
|
39 |
} |
|
40 |
|
|
41 |
} |