实质?:
都是使用了sql语句:limit语法
limit用于限制查询结果返回的数量,常用于分页查询
limit x,y 的意义是:查询偏移过x后的y条数据;
1.综合支付中使用的一个pageVo类和返回给前端的分页查询类:
分页返回的Vo类,只带有两个信息,一个是总数,另一个是数据列表
public class WebUiPage<T> {
private long total;
private List<T> rows;
public WebUiPage() {
}
public WebUiPage(long total, List<T> rows) {
this.total = total;
this.rows = rows;
}
}
PageBo类,带有两个常用信息,一个分页页数,一个分页大小
public class PageVo {
@ApiModelProperty(value = "分页页数,从0开始", required = true)
@NotNull(message = "分页页数不能为空")
private Integer pageNum;
@ApiModelProperty(value = "分页大小", required = true)
@NotNull(message = "分页大小不能为空")
private Integer pageSize;
}
之后,自行编写SQL语句,用count、limit,进行分页查询;