leutu
2024-06-03 3ef35e6cd16bbfa206b26bb3271eac40ad020bcb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.fastbee.common.core.domain;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
@Api(tags = "分页结果")
@Data
public final class PageResult<T> implements Serializable {
 
    @ApiModelProperty(value = "数据", required = true)
    private List<T> list;
 
    @ApiModelProperty(value = "总量", required = true)
    private Long total;
 
    public PageResult() {
    }
 
    public PageResult(List<T> list, Long total) {
        this.list = list;
        this.total = total;
    }
 
    public PageResult(Long total) {
        this.list = new ArrayList<>();
        this.total = total;
    }
 
    public static <T> PageResult<T> empty() {
        return new PageResult<>(0L);
    }
 
    public static <T> PageResult<T> empty(Long total) {
        return new PageResult<>(total);
    }
 
}