PageResult.java 837 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package cn.iocoder.dashboard.common.pojo;
  2. import io.swagger.annotations.ApiModel;
  3. import io.swagger.annotations.ApiModelProperty;
  4. import lombok.Data;
  5. import java.io.Serializable;
  6. import java.util.ArrayList;
  7. import java.util.List;
  8. @ApiModel("分页结果")
  9. @Data
  10. public final class PageResult<T> implements Serializable {
  11. @ApiModelProperty(value = "数据", required = true)
  12. private List<T> list;
  13. @ApiModelProperty(value = "总量", required = true)
  14. private Long total;
  15. public PageResult() {
  16. }
  17. public PageResult(List<T> list, Long total) {
  18. this.list = list;
  19. this.total = total;
  20. }
  21. public PageResult(Long total) {
  22. this.list = new ArrayList<>();
  23. this.total = total;
  24. }
  25. public static <T> PageResult<T> empty() {
  26. return new PageResult<>(0L);
  27. }
  28. }