当前位置:   article > 正文

SpringBoot正确配置PageHelper插件的方法_springboot pagehelper配置

springboot pagehelper配置

SpringBoot正确配置PageHelper插件的方法

一、前言
一个springboot项目,使用了mybatis-plus,现在要集成PageHelper实现执行sql的分页功能。

1.pom.xml中使用这个jar包:

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

2.bootstrap.yml中增加配置:

pagehelper: 
  helperDialect: mysql
  reasonable: true
  supportMethodsArguments: true
  params: count=countSql
  • 1
  • 2
  • 3
  • 4
  • 5

3.接下来需要把这个PageHelper插件注册到mybatis-plus中。
发现项目中有一个自己写的mybatis-plus配置类:

@Configuration
@ConditionalOnProperty("xx.xxx.id")
@MapperScan(basePac
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/87937
推荐阅读
相关标签
  

闽ICP备14008679号