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
package com.yanzuoguang.util.vo;
import io.swagger.annotations.ApiModelProperty;
/**
* 接口之间的通讯结果
*
* @author 颜佐光
*/
public class ResponseResultPageIndex<T> extends ResponseResult<T> {
/**
* 请求状态码
*/
@ApiModelProperty(value = "返回状态", notes = "00表示成功,其他状态表示失败,具体含义参照具体实现接口", required = true, example = "00")
private int pageIndex;
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
/**
* 构造成功结果
*
* @param data 数据
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static <T extends Object> ResponseResultPageIndex<T> result(T data, int pageIndex) {
return result(data, pageIndex, false);
}
/**
* 构造成功结果,不允许为空
*
* @param data 数据
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static <T extends Object> ResponseResultPageIndex<T> resultAllowNull(T data, int pageIndex) {
return result(data, pageIndex, true);
}
/**
* 构造成功结果
*
* @param data 数据
* @param allowNull 允许为空
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static final <T extends Object> ResponseResultPageIndex<T> result(T data, int pageIndex, boolean allowNull) {
ResponseResultPageIndex<T> ret = new ResponseResultPageIndex<T>();
ret.setData(data);
ret.setPageIndex(pageIndex);
initDataStatus(ret, data, allowNull);
return ret;
}
}