ResponseMessage包 package com.sdcet.util; public class ResponseMessage<T> { private static final Integer CODE_200=200; private static final Integer CODE_500=500; private static final String SUCCESS="SUCCESS"; private static final String FAIL="FAIL"; private Integer code; private String message; private Object data; public static ResponseMessage success(Object data){ ResponseMessage responseMessage=new ResponseMessage(); responseMessage.data=data; responseMessage.code=CODE_200; responseMessage.message=SUCCESS; return responseMessage; } public static ResponseMessage fail(){ ResponseMessage responseMessage=new ResponseMessage(); responseMessage.code=CODE_500; responseMessage.message=FAIL; return responseMessage; } public static ResponseMessage fail(String message){ ResponseMessage responseMessage=new ResponseMessage(); responseMessage.code=CODE_500; responseMessage.message=FAIL; return responseMessage; } public static Integer getCode200() { return CODE_200; } public static Integer getCode500() { return CODE_500; } public static String getSUCCESS() { return SUCCESS; } public static String getFAIL() { return FAIL; } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } }
2021-05-24
最新推荐文章于 2022-01-26 22:26:06 发布