ResultUtil.java 832 Bytes
package vion.utils;

import vion.vo.ResultVO;

public class ResultUtil {

    public static ResultVO<Object> success(Object o) {
        ResultVO<Object> resultVO = new ResultVO<Object>();
        resultVO.setCode(200);
        resultVO.setMsg("success");
        resultVO.setData(o);
        return resultVO;
    }

    public static ResultVO<Object> error(Integer code, String o) {
        ResultVO<Object> resultVO = new ResultVO<Object>();
        resultVO.setCode(code);
        resultVO.setMsg(o);
        resultVO.setData(null);
        return resultVO;
    }


    public static ResultVO<Object> error(String o) {
        return error(500, o);
    }

    public static ResultVO<Object> error() {
        return error(500, "error");
    }

    public static ResultVO<Object> success() {
        return success(null);
    }
}