package com.fzzy.igds.data;
|
|
import lombok.Data;
|
|
/**
|
* 响应结果基类
|
*/
|
@Data
|
public class BaseResp {
|
|
public static final String SUCCESS_CODE = "200";
|
|
private String code = SUCCESS_CODE;
|
|
private String message = "SUCCESS";
|
|
private String dataStr;
|
|
|
public BaseResp() {
|
super();
|
}
|
|
public BaseResp(String code, String message, String dataStr) {
|
this.code = code;
|
this.message = message;
|
this.dataStr = dataStr;
|
}
|
|
public static BaseResp success() {
|
return new BaseResp(SUCCESS_CODE, "SUCCESS", null);
|
}
|
|
public static BaseResp success(String msg) {
|
return new BaseResp(SUCCESS_CODE, msg, null);
|
}
|
|
public static BaseResp error(String msg) {
|
return new BaseResp("500", msg, null);
|
}
|
|
public static boolean isSuccess(BaseResp resp) {
|
return SUCCESS_CODE.equals(resp.getCode());
|
}
|
|
public static boolean isError(BaseResp resp) {
|
return !SUCCESS_CODE.equals(resp.getCode());
|
}
|
}
|