1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| package com.pjboy.first;
import lombok.Data;
/** * @program: first * @description: * @author: BLADE * @create: 2020-10-02 19:19 **/ @Data public class AjaxResponse { private boolean isok; private int code; // 200、400、500 private String message; private Object data; public AjaxResponse() {
}
public static AjaxResponse success() { AjaxResponse ajaxResponse = new AjaxResponse(); ajaxResponse.setIsok(true); ajaxResponse.setCode(200); ajaxResponse.setMessage("请求相应成功!"); return ajaxResponse; }
public static AjaxResponse success(Object obj) { AjaxResponse ajaxResponse = new AjaxResponse(); ajaxResponse.setIsok(true); ajaxResponse.setCode(200); ajaxResponse.setMessage("请求相应成功!"); ajaxResponse.setData(obj); return ajaxResponse; } public static AjaxResponse success(Object obj, String message) { AjaxResponse ajaxResponse = new AjaxResponse(); ajaxResponse.setIsok(true); ajaxResponse.setCode(200); ajaxResponse.setMessage(message); ajaxResponse.setData(obj); return ajaxResponse; }
}
|