|
@@ -0,0 +1,121 @@
|
|
|
|
+package com.yideb.audit.ret;
|
|
|
|
+
|
|
|
|
+import java.io.Serializable;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <b>Application name:</b> yideb-audit-statistic <br>
|
|
|
|
+ * <b>Application describing: </b> <br>
|
|
|
|
+ * <b>Copyright:</b> Copyright © 2020 明医众禾科技(北京)有限责任公司 版权所有。<br>
|
|
|
|
+ * <b>Company:</b> 明医众禾科技(北京)有限责任公司 <br>
|
|
|
|
+ * <b>@Date:</b> 2020/8/11 16:59 <br>
|
|
|
|
+ * <b>@Author:</b> <a href="mailto:lijing@miyzh.com"> 李璟 </a> <br>
|
|
|
|
+ * <b>@Checker:</b>
|
|
|
|
+ */
|
|
|
|
+public class RetData<T> implements Serializable {
|
|
|
|
+ private Integer code;
|
|
|
|
+ private String msg;
|
|
|
|
+ private T data;
|
|
|
|
+
|
|
|
|
+ public RetData() {
|
|
|
|
+ this.code = RetCode.SUCCESS.getCode();
|
|
|
|
+ this.msg = RetCode.SUCCESS.getMsg();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public RetData(RetCode retCode) {
|
|
|
|
+ this.code = retCode.getCode();
|
|
|
|
+ this.msg = retCode.getMsg();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Integer getCode() {
|
|
|
|
+ return this.code;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCode(Integer code) {
|
|
|
|
+ this.code = code;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCode(RetCode retCode) {
|
|
|
|
+ this.code = retCode.getCode();
|
|
|
|
+ this.msg = retCode.getMsg();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCode(RetCode retCode, String msg) {
|
|
|
|
+ this.code = retCode.getCode();
|
|
|
|
+ this.msg = msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getMsg() {
|
|
|
|
+ return this.msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setMsg(String msg) {
|
|
|
|
+ this.msg = msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public T getData() {
|
|
|
|
+ return this.data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setData(T data) {
|
|
|
|
+ this.data = data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData success() {
|
|
|
|
+ return ret(RetCode.SUCCESS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData success(Object data) {
|
|
|
|
+ return ret(RetCode.SUCCESS, data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData success(String msg) {
|
|
|
|
+ return ret(RetCode.SUCCESS, msg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData success(String msg, Object data) {
|
|
|
|
+ return ret(RetCode.SUCCESS, msg, data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData fail() {
|
|
|
|
+ return ret(RetCode.FAIL);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData fail(String msg) {
|
|
|
|
+ return ret(RetCode.FAIL, msg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData fail(Object data) {
|
|
|
|
+ return ret(RetCode.FAIL, data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData ret(RetCode retCode, String msg, Object data) {
|
|
|
|
+ RetData retData = new RetData(retCode);
|
|
|
|
+ retData.setData(data);
|
|
|
|
+ retData.setMsg(msg != null ? msg : retData.getMsg());
|
|
|
|
+ return retData;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData ret(RetCode retCode, String msg) {
|
|
|
|
+ return ret((RetCode)retCode, msg, (Object)null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData ret(RetCode retCode, Object data) {
|
|
|
|
+ return ret((RetCode)retCode, (String)null, data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData ret(RetCode retCode) {
|
|
|
|
+ return ret((RetCode)retCode, (String)null, (Object)null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData ret(Integer code, String msg, Object data) {
|
|
|
|
+ RetData retData = new RetData();
|
|
|
|
+ retData.setCode(code);
|
|
|
|
+ retData.setMsg(msg);
|
|
|
|
+ retData.setData(data);
|
|
|
|
+ return retData;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static RetData ret(Integer code, String msg) {
|
|
|
|
+ return ret((Integer)code, msg, (Object)null);
|
|
|
|
+ }
|
|
|
|
+}
|