dcb
2025-07-07 97629da6a002b534da10f828187fd6cd65941aa4
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
package com.se.nsl.domain.vo;
 
import io.swagger.annotations.ApiModelProperty;
import org.springframework.http.HttpStatus;
 
@SuppressWarnings("ALL")
public class R<T> {
    @ApiModelProperty("状态码:200-正常,400-请求错误,500-服务器错误")
    private int code;
 
    @ApiModelProperty("消息")
    private String msg;
 
    @ApiModelProperty("行数")
    private long count;
 
    @ApiModelProperty("数据")
    private T data;
 
    @ApiModelProperty("时间")
    private long time;
 
    public R() {
        this.time = System.currentTimeMillis();
    }
 
    public R(HttpStatus code, T data) {
        this.data = data;
        this.code = code.value();
        this.time = System.currentTimeMillis();
        this.msg = this.code == 200 ? "成功" : "失败";
    }
 
    public R(HttpStatus code, T data, String msg) {
        this.msg = msg;
        this.data = data;
        this.code = code.value();
        this.time = System.currentTimeMillis();
    }
 
    public R(HttpStatus code, T data, long count) {
        this.count = count;
        this.data = data;
        this.code = code.value();
        this.time = System.currentTimeMillis();
        this.msg = this.code == 200 ? "成功" : "失败";
    }
 
    public R(HttpStatus code, T data, long count, String msg) {
        this.msg = msg;
        this.data = data;
        this.count = count;
        this.code = code.value();
        this.time = System.currentTimeMillis();
    }
 
    public int getCode() {
        return code;
    }
 
    public void setCode(int code) {
        this.code = code;
    }
 
    public String getMsg() {
        return msg;
    }
 
    public void setMsg(String msg) {
        this.msg = msg;
    }
 
    public long getCount() {
        return count;
    }
 
    public void setCount(long count) {
        this.count = count;
    }
 
    public T getData() {
        return data;
    }
 
    public void setData(T data) {
        this.data = data;
    }
 
    public long getTime() {
        return time;
    }
 
    public void setTime(long time) {
        this.time = time;
    }
}