
com.donger.common.core.Res Maven / Gradle / Ivy
The newest version!
package com.donger.common.core;
import com.donger.common.constant.CommonConstants;
/**
* 前端通用返回类
*
* @author xyx
*/
public class Res implements CommonConstants {
private final static String SUCCESS = "success";
private final static String FAILED = "failed";
public static Result ok() {
return new Result(SUCCESS_CODE, SUCCESS);
}
public static Result ok(String message) {
return new Result(SUCCESS_CODE, message);
}
public static Result ok(T data) {
return new Result(SUCCESS_CODE, data, SUCCESS);
}
public static Result error() {
return new Result(FAIL_CODE, FAILED);
}
public static Result error(String message) {
return new Result(FAIL_CODE, message);
}
public static Result response(int code, String msg) {
return new Result(code, msg);
}
public static Result response(int code, String msg, T data) {
return new Result(code, data, msg);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy