郑永安
2023-06-19 f65443d8abeaedc9d102324565e8368e7c9d90c8
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package com.gk.firework.Domain.Utils;
 
import java.util.List;
import java.util.Map;
 
public class PageInfo {
    private final static int PAGESIZE = 10; //默认显示的记录数
 
    private List result;
 
    private Long totalCount;
 
    private Integer pageSize;
 
    private Integer pageIndex;
 
    private String sort;
 
    private String order;
 
    private int from;
 
    private int size;
 
    private Map<String, Object> condition; //查询条件
 
    public PageInfo() {}
 
    //构造方法
    public PageInfo(int pageIndex, int pageSize) {
        //计算当前页
        if (pageIndex < 0) {
            this.pageIndex = 1;
        } else {
            //当前页
            this.pageIndex = pageIndex;
        }
        //记录每页显示的记录数
        if (pageSize < 0) {
            this.pageSize = PAGESIZE;
        } else {
            this.pageSize = pageSize;
        }
        //计算开始的记录和结束的记录
        this.from = (this.pageIndex - 1) * this.pageSize;
        this.size = this.pageSize;
    }
 
    // 构造方法
    public PageInfo(int pageIndex, int pageSize, String sort, String order) {
        // 计算当前页
        if (pageIndex < 0) {
            this.pageIndex = 1;
        } else {
            // 当前页
            this.pageIndex = pageIndex;
        }
        // 记录每页显示的记录数
        if (pageSize < 0) {
            this.pageSize = PAGESIZE;
        } else {
            this.pageSize = pageSize;
        }
        // 计算开始的记录和结束的记录
        this.from = (this.pageIndex - 1) * this.pageSize;
        this.size = this.pageSize;
        // 排序字段,正序还是反序
        this.sort = sort;
        this.order = order;
    }
 
    public List getResult() {
        return result;
    }
 
    public void setResult(List result) {
        this.result = result;
    }
 
    public Long getTotalCount() {
        return totalCount;
    }
 
    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }
 
    public Integer getPageSize() {
        return pageSize;
    }
 
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
 
    public Integer getPageIndex() {
        return pageIndex;
    }
 
    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }
 
    public String getSort() {
        return sort;
    }
 
    public void setSort(String sort) {
        this.sort = sort;
    }
 
    public String getOrder() {
        return order;
    }
 
    public void setOrder(String order) {
        this.order = order;
    }
 
    public int getFrom() {
        return from;
    }
 
    public void setFrom(int from) {
        this.from = from;
    }
 
    public int getSize() {
        return size;
    }
 
    public void setSize(int size) {
        this.size = size;
    }
 
    public Map<String, Object> getCondition() {
        return condition;
    }
 
    public void setCondition(Map<String, Object> condition) {
        this.condition = condition;
    }
}