PageModel.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package jnpf.base;
  2. import io.swagger.v3.oas.annotations.media.Schema;
  3. import lombok.Data;
  4. import java.util.List;
  5. /**
  6. *
  7. * @author JNPF开发平台组
  8. * @version V3.1.0
  9. * @copyright 引迈信息技术有限公司
  10. * @date 2021/3/16 10:51
  11. */
  12. @Data
  13. public class PageModel {
  14. /**
  15. * 每页行数
  16. */
  17. private int rows;
  18. /**
  19. * 当前页
  20. */
  21. private int page;
  22. /**
  23. * 总页数
  24. */
  25. private long total;
  26. /**
  27. * 总记录数
  28. */
  29. private long records;
  30. /**
  31. * 排序列
  32. */
  33. private String sidx;
  34. /**
  35. * 排序类型
  36. */
  37. private String sord;
  38. /**
  39. * 查询条件
  40. */
  41. private String queryJson;
  42. /**
  43. * 查询关键字
  44. */
  45. private String keyword;
  46. public <T> List<T> setData(List<T> data, long records) {
  47. this.records = records;
  48. if(this.records>0){
  49. this.total = this.records % this.rows == 0 ? this.records / this.rows : this.records/this.rows+1;
  50. }else {
  51. this.total = 0;
  52. }
  53. return data;
  54. }
  55. }