|
|
@@ -0,0 +1,69 @@
|
|
|
+package com.leanwo.gateway.dto;
|
|
|
+
|
|
|
+/**
|
|
|
+ * HTTP 响应基类.
|
|
|
+ *
|
|
|
+ * @author YangZhiJie 2021-09-09
|
|
|
+ */
|
|
|
+public class BaseResponse {
|
|
|
+
|
|
|
+ /** 错误码,0:正常,<0:异常, >0: 异常. */
|
|
|
+ private int errorCode;
|
|
|
+
|
|
|
+ /** 错误消息,OK:正常,其他:异常消息. */
|
|
|
+ private String errorMessage;
|
|
|
+
|
|
|
+ public BaseResponse() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public BaseResponse(int errorCode, String errorMessage) {
|
|
|
+ this.errorCode = errorCode;
|
|
|
+ this.errorMessage = errorMessage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Gets the 错误码,0:正常,<0:异常, >0: 异常.
|
|
|
+ *
|
|
|
+ * @return the 错误码,0:正常,<0:异常, >0: 异常
|
|
|
+ */
|
|
|
+ public int getErrorCode() {
|
|
|
+ return errorCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets the 错误码,0:正常,<0:异常, >0: 异常.
|
|
|
+ *
|
|
|
+ * @param errorCode the new 错误码,0:正常,<0:异常, >0: 异常
|
|
|
+ */
|
|
|
+ public void setErrorCode(int errorCode) {
|
|
|
+ this.errorCode = errorCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Gets the 错误消息,OK:正常,其他:异常消息.
|
|
|
+ *
|
|
|
+ * @return the 错误消息,OK:正常,其他:异常消息
|
|
|
+ */
|
|
|
+ public String getErrorMessage() {
|
|
|
+ return errorMessage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets the 错误消息,OK:正常,其他:异常消息.
|
|
|
+ *
|
|
|
+ * @param errorMessage the new 错误消息,OK:正常,其他:异常消息
|
|
|
+ */
|
|
|
+ public void setErrorMessage(String errorMessage) {
|
|
|
+ this.errorMessage = errorMessage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 复制BaseResponse
|
|
|
+ * @param baseResponse
|
|
|
+ */
|
|
|
+ public void copy(BaseResponse baseResponse) {
|
|
|
+ this.setErrorCode(baseResponse.getErrorCode());
|
|
|
+ this.setErrorMessage(baseResponse.getErrorMessage());
|
|
|
+ }
|
|
|
+}
|