1、實現序列化接口
2、返回數據的rows屬性,爲了確保傳遞不同類型的數據,要設置爲泛型(其他實體類也都要實現序列化接口)
3、無參和有參構造方法
public class PageResult implements Serializable {
private Long total;
private List<?> rows;
public PageResult() {
}
public PageResult(Long total, List<?> rows) {
this.total = total;
this.rows = rows;
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public List<?> getRows() {
return rows;
}
public void setRows(List<?> rows) {
this.rows = rows;
}
}