mirror of
https://github.com/201206030/novel-cloud.git
synced 2025-04-27 01:40:50 +00:00
ResultBean还原
暂时解决controller的编译报错,后面有时间再重构系统
This commit is contained in:
parent
386afa49c9
commit
24b24acae4
@ -7,11 +7,10 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义Api响应结构
|
* 自定义Api响应结构
|
||||||
*
|
|
||||||
* @param <T> 响应数据类型
|
|
||||||
* @author xiongxiaoyang
|
* @author xiongxiaoyang
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @since 2020/5/23
|
* @since 2020/5/23
|
||||||
|
* @param <T> 响应数据类型
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ResultBean<T>{
|
public class ResultBean<T>{
|
||||||
@ -21,12 +20,12 @@ public class ResultBean<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应消息
|
* 响应消息
|
||||||
*/
|
* */
|
||||||
@ApiModelProperty(value = "响应状态信息")
|
@ApiModelProperty(value = "响应状态信息")
|
||||||
private String msg = ResponseStatus.OK.getMsg();
|
private String msg = ResponseStatus.OK.getMsg();
|
||||||
/**
|
/**
|
||||||
* 响应中的数据
|
* 响应中的数据
|
||||||
*/
|
* */
|
||||||
@ApiModelProperty(value = "响应数据")
|
@ApiModelProperty(value = "响应数据")
|
||||||
private T data;
|
private T data;
|
||||||
|
|
||||||
@ -34,9 +33,9 @@ public class ResultBean<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResultBean(ResponseStatus responseStatus) {
|
private ResultBean(ResponseStatus ResponseStatus) {
|
||||||
this.code = responseStatus.getCode();
|
this.code = ResponseStatus.getCode();;
|
||||||
this.msg = responseStatus.getMsg();
|
this.msg = ResponseStatus.getMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResultBean(T data) {
|
private ResultBean(T data) {
|
||||||
@ -44,33 +43,34 @@ public class ResultBean<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务处理成功,无数据返回
|
* 业务处理成功,无数据返回
|
||||||
*/
|
* */
|
||||||
public static ResultBean<Void> ok() {
|
public static ResultBean ok() {
|
||||||
return new ResultBean<>();
|
return new ResultBean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务处理成功,有数据返回
|
* 业务处理成功,有数据返回
|
||||||
*/
|
* */
|
||||||
public static <T> ResultBean<T> ok(T data) {
|
public static <T> ResultBean ok(T data) {
|
||||||
return new ResultBean<>(data);
|
return new ResultBean(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务处理失败
|
* 业务处理失败
|
||||||
*/
|
* */
|
||||||
public static ResultBean<Void> fail(ResponseStatus responseStatus) {
|
public static ResultBean fail(ResponseStatus ResponseStatus) {
|
||||||
return new ResultBean<>(responseStatus);
|
return new ResultBean(ResponseStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统错误
|
* 系统错误
|
||||||
*/
|
* */
|
||||||
public static ResultBean<Void> error() {
|
public static ResultBean error() {
|
||||||
return new ResultBean<>(ResponseStatus.ERROR);
|
return new ResultBean(ResponseStatus.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user