分页插件pagehelper的运用(超舒服,以后再也不用在sql里写)
不多说直接上代码(两步解决)
1.pom引入依赖
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.10</version> </dependency>
2.运用
PageHelper.startPage(pageNum,pageSize);
List<Product> products = ProductService.selectProductList();
PageInfo<Product> productsPageInfo = new PageInfo<>(products);
只需要接受前端的PageNum(当前页),PageSize(一页显示的数量) 得到的结果集中 会有一个total字段(总数)
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/a/22896.html
- 上一篇:mysql:中文字符显示问号的问题
- 下一篇:sql 基本语法