|
@@ -13,7 +13,10 @@ import org.springframework.http.HttpStatus;
|
|
@Data
|
|
@Data
|
|
public class ViewResult<T> {
|
|
public class ViewResult<T> {
|
|
|
|
|
|
- @ApiModelProperty("返回码")
|
|
|
|
|
|
+ @ApiModelProperty("http状态码")
|
|
|
|
+ private Integer status;
|
|
|
|
+
|
|
|
|
+ @ApiModelProperty(value = "返回码", name = "0和1")
|
|
private Integer code;
|
|
private Integer code;
|
|
|
|
|
|
@ApiModelProperty("返回说明")
|
|
@ApiModelProperty("返回说明")
|
|
@@ -30,39 +33,41 @@ public class ViewResult<T> {
|
|
this.code = code;
|
|
this.code = code;
|
|
}
|
|
}
|
|
|
|
|
|
- public ViewResult(Integer code, String msg) {
|
|
|
|
|
|
+ public ViewResult(Integer status, Integer code, String msg) {
|
|
|
|
+ this.status = status;
|
|
this.code = code;
|
|
this.code = code;
|
|
this.msg = msg;
|
|
this.msg = msg;
|
|
}
|
|
}
|
|
|
|
|
|
- public ViewResult(Integer code, String msg, T data) {
|
|
|
|
|
|
+ public ViewResult(Integer status, Integer code, String msg, T data) {
|
|
|
|
+ this.status = status;
|
|
this.code = code;
|
|
this.code = code;
|
|
this.msg = msg;
|
|
this.msg = msg;
|
|
this.data = data;
|
|
this.data = data;
|
|
}
|
|
}
|
|
|
|
|
|
public static ViewResult success() {
|
|
public static ViewResult success() {
|
|
- return new ViewResult(HttpStatus.OK.value(), "操作成功");
|
|
|
|
|
|
+ return new ViewResult(HttpStatus.OK.value(), 0,"操作成功");
|
|
}
|
|
}
|
|
|
|
|
|
public static ViewResult success(Object data) {
|
|
public static ViewResult success(Object data) {
|
|
- return new ViewResult(HttpStatus.OK.value(), "成功", data);
|
|
|
|
|
|
+ return new ViewResult(HttpStatus.OK.value(), 0, "成功", data);
|
|
}
|
|
}
|
|
|
|
|
|
public static ViewResult success(Integer code, String msg, Object data) {
|
|
public static ViewResult success(Integer code, String msg, Object data) {
|
|
- return new ViewResult(code, msg, data);
|
|
|
|
|
|
+ return new ViewResult(code, 0, msg, data);
|
|
}
|
|
}
|
|
|
|
|
|
- public static ViewResult success(Integer code, String msg) {
|
|
|
|
- return new ViewResult(code, msg);
|
|
|
|
|
|
+ public static ViewResult success(Integer status, Integer code, String msg) {
|
|
|
|
+ return new ViewResult(HttpStatus.OK.value(), 0, msg);
|
|
}
|
|
}
|
|
|
|
|
|
public static ViewResult error(String msg) {
|
|
public static ViewResult error(String msg) {
|
|
- return new ViewResult(500, msg);
|
|
|
|
|
|
+ return new ViewResult(HttpStatus.INTERNAL_SERVER_ERROR.value(), 1, msg);
|
|
}
|
|
}
|
|
|
|
|
|
public static ViewResult error(Integer code, String msg) {
|
|
public static ViewResult error(Integer code, String msg) {
|
|
- return new ViewResult(code, msg);
|
|
|
|
|
|
+ return new ViewResult(HttpStatus.INTERNAL_SERVER_ERROR.value(), 1, msg);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|