package com.warewms.common.utils;

/**
 * ClassName    QueryResult
 * Description  查询返回
 * Author       coder
 * Date         2019/9/26 10:00 PM
 * Version      1.0
 **/
public class QueryResult {

    private boolean success = false;// 是否成功
    private String msg = "";// 提示信息
    private Object obj = null;// 其他信息

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public static QueryResult success(String msg){
        QueryResult json = new QueryResult();
        json.setMsg(msg);
        json.setSuccess(true);
        return json;
    }

    public static QueryResult success(String msg,Object data){
        QueryResult json = new QueryResult();
        json.setMsg(msg);
        json.setObj(data);
        json.setSuccess(true);
        return json;
    }

    public static QueryResult error(String msg){
        QueryResult json = new QueryResult();
        json.setMsg(msg);
        json.setSuccess(false);
        return json;
    }
}
