package com.donglan.ahxf.ahxfmeetregisterwindow.common;

import lombok.Data;

/**
 * @author shj
 * @date 2019-10-09 14:58
 */
@Data
public class Result {
    private Boolean flag;
    private Integer code;
    private String msg;
    private Object data;

    public Result() {
    }

    public Result(Boolean flag,Integer code, String msg) {
        this.flag = flag;
        this.code = code;
        this.msg = msg;
    }

    public Result(Boolean flag,Integer code, String msg, Object data) {
        this.flag = flag;
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success(){
        return  new Result(true,200,"操作成功");
    }

    public static Result success(Object data){
        return  new Result(true,200,"操作成功",data);
    }

    public static Result success(String msg,Object data){
        return  new Result(true,200,msg,data);
    }

    public static Result success(Integer code,String msg,Object data){
        return  new Result(true,code,msg,data);
    }

    public static Result fail(Object data){
        return  new Result(false,0,"操作失败",null);
    }

    public static Result fail(String msg,Object data){
        return  new Result(false,0,msg,null);
    }

    public static Result fail(Integer code,String msg,Object data){
        return  new Result(false,code,msg,null);
    }
}
