You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
60 lines
1.4 KiB
package com.bfd.crawl.ppthandler.bean;
|
|
|
|
|
|
|
|
import com.bfd.crawl.ppthandler.enums.ResponseCode;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Data;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
/**
|
|
* @author:jinming
|
|
* @className:ResponsePo
|
|
* @version:1.0
|
|
* @description:
|
|
* @Date:2023/4/3 17:23
|
|
*/
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
public class ResponsePo {
|
|
/**
|
|
* 响应码
|
|
*/
|
|
private int code;
|
|
|
|
/**
|
|
* 正常放 返回数据 的JSON串
|
|
*/
|
|
private Object data;
|
|
|
|
/**
|
|
* 提示消息
|
|
*/
|
|
private String message;
|
|
|
|
public static ResponsePo success() {
|
|
return setStatus(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
|
|
}
|
|
|
|
public static ResponsePo error() {
|
|
return setStatus(ResponseCode.FAILURE.getCode(), ResponseCode.FAILURE.getMessage());
|
|
}
|
|
|
|
public static ResponsePo setStatus(int code, String message) {
|
|
ResponsePo resultBean = new ResponsePo();
|
|
resultBean.code = code;
|
|
resultBean.message = message;
|
|
return resultBean;
|
|
}
|
|
public ResponsePo(int code, String message) {
|
|
this.code = code;
|
|
this.message = message;
|
|
this.data = data;
|
|
}
|
|
public ResponsePo(ResponseCode responseCode){
|
|
this.code = responseCode.getCode();
|
|
this.message = responseCode.getMessage();
|
|
this.data = data;
|
|
}
|
|
}
|