分页也是1个对象嘛。PageResult<ApplicationDto>
public class PageResult<T> implements Serializable {
private static final long serialVersionUID = -7972346802746726513L;
@ApiModelProperty(
value = "当前页码",
required = true
)
private Integer currentPage;
@ApiModelProperty(
value = "每页条数",
required = true
)
private Integer pageSize;
@ApiModelProperty(
value = "总页数",
required = true
)
private Integer totalPage;
@ApiModelProperty(
value = "总记录数",
required = true
)
private final Long total;
@ApiModelProperty("当前页数据")
private final List<T> list;
由list来承载数据。我们来看看每页10条的记录返回的数据是什么?(假设可以查到的数据有12条)
所以,当包裹着T的对象传过来,其实是把你需要的数据给你。我们来看看请求头发了什么?
所以,传过来page和size,其实就是说我要第几页,每页有多少。
这样,后段查数据库的时候,就可以用一些比如limit,这样的sql来控制查询条件。