package com.yc.wms.until;

import lombok.Data;

@Data
public class Result {
    private int code;//编码
    private String msg;//内容
    private long total;//总记录数
    private Object data;//数据


    public  static  Result fail(){
        return result(400,"操作失败!",0,null);
    }

    public  static  Result fail(String msg){
        return result(400,msg,0,null);
    }

    public  static  Result success(){
        return result(200,"操作成功!",0,null);
    }

    public  static  Result success(Object data){
        return result(200,"操作成功!",0,data);
    }

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

    public  static  Result success(long total,Object data){
        return result(200,"操作成功!",total,data);
    }

    public  static  Result result(int code,String msg,long total,Object data){
        Result rs=new Result();
        rs.setCode(code);
        rs.setMsg(msg);
        rs.setTotal(total);
        rs.setData(data);
        return rs;
    }
}
