朱俊杰
2022-02-10 37a84e66917d6e22e03e31b0a115e2c16d23ed21
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
package com.genersoft.iot.vmp.vmanager.bean;
 
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
 
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WVPResult<T> {
 
    private int code;
    private String msg;
    private T data;
 
    private static final Integer SUCCESS = 200;
    private static final Integer FAILED = 400;
 
    public static <T> WVPResult<T> Data(T t, String msg) {
        return new WVPResult<>(SUCCESS, msg, t);
    }
 
    public static <T> WVPResult<T> Data(T t) {
        return Data(t, "成功");
    }
 
    public static <T> WVPResult<T> fail(int code, String msg) {
        return new WVPResult<>(code, msg, null);
    }
 
    public static <T> WVPResult<T> fail(String msg) {
        return fail(FAILED, msg);
    }
 
}