审查视图

src/main/java/com/tianbo/analysis/model/ResultJson.java 1.1 KB
朱兆平 authored
1
package com.tianbo.analysis.model;
朱兆平 authored
2
3
import com.tianbo.analysis.controller.bean.ResponseReason;
朱兆平 authored
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
import lombok.Data;

import java.io.Serializable;

@Data
public class ResultJson<T> implements Serializable{
    private static final long serialVersionUID = 1L;

    // 状态码 正确为200
    private String code = "200";
    // 描述
    private String msg = "";

    private String error;
    // 返回对象
    private T data;
    //返回的JWT
    private String jwtToken;
23 24
    private ResponseReason responseReason;
朱兆平 authored
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    public ResultJson() {
    }

    public ResultJson(String code) {
        this.code = code;
    }

    public ResultJson(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultJson(T data) {
        this.data = data;
    }

    public ResultJson(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
46 47 48 49 50 51 52

    public ResultJson(ResponseReason responseReason) {
        this.responseReason = responseReason;
        this.code = responseReason.getCode();
        this.msg = responseReason.getMsg();

    }
朱兆平 authored
53
}