zhangyong
2024-01-10 4abee8e36e3259fcf77cc1d1879a2d959edc8297
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
package com.example.springboot.entity.vo;
 
import lombok.Data;
 
@Data
public class Result {
    private Integer code;
    private String msg;
    private Object data;
 
 
 
 
    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(1);
        result.setMsg("成功");
        result.setData(data);
        return result;
    }
 
    public static Result success() {
        return success(null);
    }
 
    public static Result fail(String msg) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg(msg);
        return result;
    }
 
    public static Result fail(Integer code, String msg, Object object) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg(msg);
        result.setData(object);
        return result;
    }
}