package com.lantone.structure.dto;

import java.io.Serializable;

public class RespDTO<T> implements Serializable {
    
    public String code = "0";
    public String msg = "";
    public T data;

    public static RespDTO onSuc(Object data) {
        RespDTO resp = new RespDTO();
        resp.data = data;
        return resp;
    }

    public static RespDTO onError(String errMsg) {
        RespDTO resp = new RespDTO();
        resp.code = "-1";
        resp.msg = errMsg;
        return resp;
    }

    @Override
    public String toString() {
        return "RespDTO{" +
                "code=" + code +
                ", error='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
