使用泛型无法识别文档注释 这种问题该怎么解决呢?
[Asm] 纯文本查看 复制代码 public class PageResult<T> {
private Integer code;
private String msg;
private ResultData data = new ResultData();
public Integer getCode() {
return this.code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return this.msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public ResultData getData() {
return this.data;
}
public void setData(ResultData data) {
this.data = data;
}
public PageResult() {
}
public PageResult(Integer code, String msg, T data, Integer page, Integer pageSize, Integer total) {
this.code = code;
this.msg = msg;
this.data.setPage(page);
this.data.setPageSize(pageSize);
this.data.setTotal(total);
this.data.setData(data);
if (total > 0) {
this.data.setPages(total % pageSize != 0 ? total / pageSize + 1 : total / pageSize);
}
}
public PageResult(String msg) {
this.code = -1;
this.msg = msg;
}
public static <T> PageResult<T> success(T data) {
if (data instanceof Page) {
Page<T> page = (Page) data;
return new PageResult(0, "操作成功", data, page.getPageNum(), page.getPageSize(), (int) page.getTotal());
}else if (data instanceof IPage){
IPage<T> page=(IPage)data;
return new PageResult(0,"操作成功",page.getRecords(),(int) page.getPages(),(int) page.getSize(),(int) page.getTotal());
}else {
return null;
}
}
public static PageResult error(String msg) {
return new PageResult(msg);
}
}
|