1、引入POM

1 <dependency>
2 <groupId>com.github.pagehelper</groupId>
3 <artifactId>pagehelper</artifactId>
4 <version>5.2.0</version>
5 </dependency>

2、Mybatis添加PageHepler配置

@Bean
public PageInterceptor pageInterceptor(){
PageInterceptor pageInterceptor = new PageInterceptor();
Properties properties=new Properties();
properties.setProperty("helperDialect","mysql");
properties.setProperty("helperDialect","mysql");
properties.setProperty("reasonable","true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params","count=countSql");
pageInterceptor.setProperties(properties);
return pageInterceptor;
}

3、代码中使用

public PageInfo<OauthClientDetail> listByPage(Integer page, Integer limit){
PageHelper.startPage(page,limit);
List<OauthClientDetail> oauthClientDetails = oauthClientDetailsMapper.listByPage();
return PageInfo.of(oauthClientDetails);
、}

PageHeplper使用的更多相关文章

随机推荐

  1. C#中DataTable新增列、删除列、更改列名、交换列位置

    一.新增列 1.1.新增列 /*新增列*/ dataTable.Columns.Add("列名称", Type.GetType("数据类型")); /*比如添加 ...

  2. sql常用记录

    sqlserver 在已有值的列上自动增加 获取列最大的值 declare @Field int select @Field = ISNULL(Max(Field),0) from SupCsBill ...

  3. k8s volumes

    NFS: apiVersion: v1 kind: Pod metadata: name: test-pd spec: containers: - image: registry.k8s.io/tes ...

  4. ssh 免密访问

    首先配置三台机器的hosts文件 填写需要配置的三台主机ip,然后命名,这里我写的时 t1 t2 t3 三台机器上都要配置hosts文件,要配置一样. 三台机器改完后保存退出 ping一下刚才配置的三 ...

  5. MSDTC突然停用了,后台数据无法更新

    由于前台电脑停电突然关机,导致重启后发现MSDTC无法更新数据,重新添加了link,只能查询,更新失败,报错:无活动事务 1.修改host设置,在C:\Windows\System32\drivers ...

  6. import cv2时出现ImportError: DLL load fail:找不到指定模块

  7. 初玩mybatis-Plus踩过的小坑(粗心大意)

    一开始没设置全局id为数据库自增长(数据库也要勾上自增长) 他是默认使用ID_WORKER生成id的 ,然后当我重新设置为自增长后 发现生成的id还是20位数,局部id也设置了 还是没用 ,百度说哪个 ...

  8. 3.Linux安装docker

    Docker作为一个软件集装箱化平台,可以让开发者构建应用程序时,将它与其依赖环境一起打包到一个容器中,然后很容易地发布和应用到任意平台中. 进入docker官网找到安装文档 https://docs ...

  9. sed: -e 表达式 #1, 字符 1: 未知的命令:“'”

    https://blog.csdn.net/linmingan/article/details/80007727 加双引号!! 利用sed更改文件test.txt的第一行为abc: sed -i '1 ...

  10. 打卡node day03 --http 内置模块

    1.内置模块 http 2.加上校验 3.cheerio 可以使用jq 里的选择器 4.结合使用 5.获取的数据是http 路径 拿到具体的图片 6.循环图片