package io.renren.application.common.vo;

import lombok.Data;

@Data
public class Results<T> {

    Integer code;
    String msg;
    T data;

    public static Results success(){
        Results result = new Results();
        result.setCode(1);
        return result;
    }

    public static <T> Results success(T t){
        Results result = success();
        result.setData(t);
        return result;
    }

    public static Results error(){
        Results result = new Results();
        result.setCode(0);
        return result;
    }

    public static Results error(String msg){
        Results result = error();
        result.setMsg(msg);
        return result;
    }

    public static Results error(Integer code,String msg){
        Results result = error();
        result.setMsg(msg);
        result.setCode(code);
        return result;
    }
}
