wanghc
2023-03-08 6cbbff8da2e0fb2645d90a4e250368769ebd2da8
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
package com.jttech.pfcs.vo.resp;
 
import java.io.Serializable;
 
/**
 * 基础返回对象
 * @author wanghc
 * @version 1.0.0
 * @date 2023-03-07
 */
public class ResponseVo implements Serializable {
 
    private static final long serialVersionUID = 7564240277258758852L;
    /**
     * 错误码 等于0为成功
     */
    private int errorCode = 0;
    /**
     * 异常信息
     */
    private String errMsg = "操作成功";
    /**
     * 内容对象
     */
    private Object body;
 
    public static ResponseVo ok(Object body) {
        return new ResponseVo(body);
    }
 
    public static ResponseVo fail(int errorCode, String errMsg) {
        return new ResponseVo(errorCode, errMsg, null);
    }
 
    public ResponseVo() {
    }
 
    public ResponseVo(int pErrorCode, String pErrMsg, Object pBody) {
        errorCode = pErrorCode;
        errMsg = pErrMsg;
        body = pBody;
    }
 
    public ResponseVo(Object pBody) {
        body = pBody;
    }
 
    public int getErrorCode() {
        return errorCode;
    }
 
    public void setErrorCode(int pErrorCode) {
        errorCode = pErrorCode;
    }
 
    public String getErrMsg() {
        return errMsg;
    }
 
    public void setErrMsg(String pErrMsg) {
        errMsg = pErrMsg;
    }
 
    public Object getBody() {
        return body;
    }
 
    public ResponseVo setBody(Object pBody) {
        body = pBody;
        return this;
    }
}