|
@@ -0,0 +1,114 @@
|
|
|
+package com.winhc.repal.cloud.vo;
|
|
|
+
|
|
|
+
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
+import lombok.Getter;
|
|
|
+import lombok.Setter;
|
|
|
+
|
|
|
+@Getter
|
|
|
+@Setter
|
|
|
+public class ResponseVO<T> {
|
|
|
+
|
|
|
+ @ApiModelProperty(value="成功:00; 失败:99",name="code", example="SUCCESS")
|
|
|
+ private String code;
|
|
|
+ @ApiModelProperty(value="返回消息",name="msg",example="操作成功")
|
|
|
+ private String msg;
|
|
|
+ @ApiModelProperty(value="返回消息",name="msg",example="操作成功")
|
|
|
+ private String isSuccess;
|
|
|
+ @ApiModelProperty(value="返回体",name="body",example="{}")
|
|
|
+ private T body;
|
|
|
+ @ApiModelProperty(value="成功:00; 失败:99",name="code", example="SUCCESS")
|
|
|
+ private String errorCode;
|
|
|
+ @ApiModelProperty(value="返回消息",name="msg",example="操作成功")
|
|
|
+ private String errorMsg;
|
|
|
+
|
|
|
+ public String getErrorCode() {
|
|
|
+ return errorCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setErrorCode(String errorCode) {
|
|
|
+ this.errorCode = errorCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getErrorMsg() {
|
|
|
+ return errorMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setErrorMsg(String errorMsg) {
|
|
|
+ this.errorMsg = errorMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getIsSuccess() {
|
|
|
+ return isSuccess;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setIsSuccess(String isSuccess) {
|
|
|
+ this.isSuccess = isSuccess;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static <T> ResponseVO<T> retSuccess(T body){
|
|
|
+ ResponseVO<T> vo = new ResponseVO<>(body);
|
|
|
+ return vo.success();
|
|
|
+ }
|
|
|
+ public ResponseVO(T body) {
|
|
|
+ this.body = body;
|
|
|
+ }
|
|
|
+ public ResponseVO() {}
|
|
|
+
|
|
|
+ public static <T> ResponseVO<T> retSuccess(){
|
|
|
+ ResponseVO<T> vo = new ResponseVO<>();
|
|
|
+ return vo.success();
|
|
|
+ }
|
|
|
+ public static <T> ResponseVO<T> retFail(){
|
|
|
+ ResponseVO<T> vo = new ResponseVO<>();
|
|
|
+ return vo.fail();
|
|
|
+ }
|
|
|
+ public static <T> ResponseVO<T> retFail(String msg){
|
|
|
+ ResponseVO<T> vo = new ResponseVO<>();
|
|
|
+ return vo.fail(msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResponseVO<T> success(){
|
|
|
+ return success("操作成功");
|
|
|
+ }
|
|
|
+ public ResponseVO<T> success(String msg){
|
|
|
+ code = "00";
|
|
|
+ errorCode="00";
|
|
|
+ this.errorMsg=msg;
|
|
|
+ this.msg = msg;
|
|
|
+ isSuccess="T";
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResponseVO<T> fail(){
|
|
|
+ return fail("");
|
|
|
+ }
|
|
|
+ public ResponseVO<T> fail(String msg){
|
|
|
+ code = "99";
|
|
|
+ isSuccess="F";
|
|
|
+ errorCode="99";
|
|
|
+ this.errorMsg=msg;
|
|
|
+ this.msg = msg;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getCode() {
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setCode(String code) {
|
|
|
+ this.code = code;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMsg() {
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMsg(String msg) {
|
|
|
+ this.msg = msg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|