|
|
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
|
import lombok.NoArgsConstructor;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
/**
|
|
|
* @author TRX
|
|
|
@@ -20,11 +21,28 @@ public class SuperResponseModel {
|
|
|
@Schema(description = "失败消息")
|
|
|
private String msg;
|
|
|
|
|
|
+ private String errCode;
|
|
|
+
|
|
|
+ private String errInfo;
|
|
|
+
|
|
|
public boolean isSuccess = true;
|
|
|
|
|
|
@Schema(description = "消耗的毫秒数")
|
|
|
private Long millis;
|
|
|
|
|
|
+ public void setCode(int code) {
|
|
|
+ this.code = code;
|
|
|
+ if (code == 200) {
|
|
|
+ this.isSuccess = true;
|
|
|
+ } else {
|
|
|
+ this.isSuccess = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isFailed() {
|
|
|
+ return !this.isSuccess;
|
|
|
+ }
|
|
|
+
|
|
|
public void setFailed(String msg) {
|
|
|
this.msg = msg;
|
|
|
isSuccess = false;
|
|
|
@@ -35,4 +53,11 @@ public class SuperResponseModel {
|
|
|
isSuccess = true;
|
|
|
}
|
|
|
|
|
|
+ public String getMsg() {
|
|
|
+ if (StringUtils.isNotEmpty(errInfo)) {
|
|
|
+ return errInfo;
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
}
|