lizijie
2021-11-29 d8310f6bc609440fa352c0e5a9436c7c78caa287
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
package com.moral.common;
 
import java.io.Serializable;
 
public class ResultBean<T> implements Serializable {
 
    private static final long serialVersionUID = 1L;
 
    public static final int FAIL = 0;
    public static final int SUCCESS = 1;
    public static final int NO_PERMISSION = 2;
    private String message;
    private Integer code;
    private T data;
 
    public ResultBean() {
    }
    public static ResultBean success(){
        return new ResultBean("操作成功",SUCCESS);
    }
    public static ResultBean fail(){
        return fail("操作失败");
    }
    public static ResultBean fail(String msg){
        return new ResultBean(msg,FAIL);
    }
    public ResultBean(Throwable e) {
        this.message = e.toString();
        this.code = FAIL;
    }
 
    public ResultBean(T data) {
        this.message = "success";
        this.code = SUCCESS;
        this.data = data;
    }
 
    public ResultBean(String message, int code) {
        this.message = message;
        this.code = code;
    }
    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }
    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }
    /**
     * @return the code
     */
    public Integer getCode() {
        return code;
    }
    /**
     * @param code the code to set
     */
    public void setCode(Integer code) {
        this.code = code;
    }
    /**
     * @return the data
     */
    public T getData() {
        return data;
    }
    /**
     * @param data the data to set
     */
    public void setData(T data) {
        this.data = data;
    }
}