package com.ruoyi.payment.common;
|
|
import java.io.Serializable;
|
|
/**
|
* 统一响应结果
|
*
|
* @author ruoyi
|
*/
|
public class AjaxResult implements Serializable {
|
private static final long serialVersionUID = 1L;
|
|
/** 状态码 */
|
private int code;
|
|
/** 返回消息 */
|
private String msg;
|
|
/** 返回数据 */
|
private Object data;
|
|
public AjaxResult() {
|
}
|
|
public AjaxResult(int code, String msg) {
|
this.code = code;
|
this.msg = msg;
|
}
|
|
public AjaxResult(int code, String msg, Object data) {
|
this.code = code;
|
this.msg = msg;
|
this.data = data;
|
}
|
|
public static AjaxResult success() {
|
return new AjaxResult(200, "操作成功");
|
}
|
|
public static AjaxResult success(String msg) {
|
return new AjaxResult(200, msg);
|
}
|
|
public static AjaxResult success(Object data) {
|
return new AjaxResult(200, "操作成功", data);
|
}
|
|
public static AjaxResult success(String msg, Object data) {
|
return new AjaxResult(200, msg, data);
|
}
|
|
public static AjaxResult error() {
|
return new AjaxResult(500, "操作失败");
|
}
|
|
public static AjaxResult error(String msg) {
|
return new AjaxResult(500, msg);
|
}
|
|
public static AjaxResult error(int code, String msg) {
|
return new AjaxResult(code, msg);
|
}
|
|
public int getCode() {
|
return code;
|
}
|
|
public void setCode(int code) {
|
this.code = code;
|
}
|
|
public String getMsg() {
|
return msg;
|
}
|
|
public void setMsg(String msg) {
|
this.msg = msg;
|
}
|
|
public Object getData() {
|
return data;
|
}
|
|
public void setData(Object data) {
|
this.data = data;
|
}
|
}
|