通用返回类responseEntity或者ajaxinfo

阅读 18

2023-02-28


@Data
public class AjaxInfo {
public AjaxInfo(){

}
public AjaxInfo(Integer code,String msg){
this.code=code;
this.msg=msg;
}

private Integer code=0;

private String msg="操作成功";

private Object data;


public boolean isSuccess( ){
if(0 == code){
return true;
}else{
return false;
}
}

public static void main(String[] args) {
AjaxInfo ajaxInfo = new AjaxInfo();

ajaxInfo.setMsg("找不到页面");
if(ajaxInfo.isSuccess()){

}else{
System.out.println(JSON.toJSONString(ajaxInfo));
}

}
}


精彩评论(0)

0 0 举报