package com.se.nsl.domain.vo;
|
|
import io.swagger.annotations.ApiModelProperty;
|
import org.springframework.http.HttpStatus;
|
|
@SuppressWarnings("ALL")
|
public class R<T> {
|
@ApiModelProperty("状态码:200-正常,400-请求错误,500-服务器错误")
|
private int code;
|
|
@ApiModelProperty("消息")
|
private String msg;
|
|
@ApiModelProperty("行数")
|
private long count;
|
|
@ApiModelProperty("数据")
|
private T data;
|
|
@ApiModelProperty("时间")
|
private long time;
|
|
public R() {
|
this.time = System.currentTimeMillis();
|
}
|
|
public R(HttpStatus code, T data) {
|
this.data = data;
|
this.code = code.value();
|
this.time = System.currentTimeMillis();
|
this.msg = this.code == 200 ? "成功" : "失败";
|
}
|
|
public R(HttpStatus code, T data, String msg) {
|
this.msg = msg;
|
this.data = data;
|
this.code = code.value();
|
this.time = System.currentTimeMillis();
|
}
|
|
public R(HttpStatus code, T data, long count) {
|
this.count = count;
|
this.data = data;
|
this.code = code.value();
|
this.time = System.currentTimeMillis();
|
this.msg = this.code == 200 ? "成功" : "失败";
|
}
|
|
public R(HttpStatus code, T data, long count, String msg) {
|
this.msg = msg;
|
this.data = data;
|
this.count = count;
|
this.code = code.value();
|
this.time = System.currentTimeMillis();
|
}
|
|
public int getCode() {
|
return code;
|
}
|
|
public void setCode(int code) {
|
this.code = code;
|
}
|
|
public String getMsg() {
|
return msg;
|
}
|
|
public void setMsg(String msg) {
|
this.msg = msg;
|
}
|
|
public long getCount() {
|
return count;
|
}
|
|
public void setCount(long count) {
|
this.count = count;
|
}
|
|
public T getData() {
|
return data;
|
}
|
|
public void setData(T data) {
|
this.data = data;
|
}
|
|
public long getTime() {
|
return time;
|
}
|
|
public void setTime(long time) {
|
this.time = time;
|
}
|
}
|