ResultUtils.java
package com.imddysc.study.sqlmonitor.utils;
public class ResultUtils {
/** 成功,生成返回成功的结果 */
public static Result success() {
Result result = new Result();
result.setResultCode(ResultCode.SUCCESS);
return result;
}
/** 成功,加上data 生成返回成功的结果 */
public static Result success(Object data) {
Result result = new Result();
result.setResultCode(ResultCode.SUCCESS);
result.setData(data);
return result;
}
/** 失败, 生成返回失败的结果 */
public static Result failure() {
Result result = new Result();
result.setResultCode(ResultCode.FAILURE);
return result;
}
/** 失败,加上data 生成返回失败的结果 */
public static Result failure(Object data) {
Result result = new Result();