springboot集成Mybatis分页插件pageHelper

配置mybatis-config.xml

    <plugins>

      <plugin  interceptor="com.github.pagehelper.PageInterceptor"></plugin>

</plugins>

加入Jar

<dependency>

    <groupId>com.github.pagehelper</groupId>

   <artifactId>pagehelper</artifactId>

    <version>1.2.5</version>

</dependency>

//serviceImpl中的类

public PageInfo<User> selectOptLog(int pageNum,int page){

    PageHelper.startPage(pageNum,pageSize());

    List<User> list=userMapper.selectAll();

    PageInfo<UserLogDTO> pageInfo = new PageInfo<>(list);

    return pageInfo;

}

猜你喜欢

转载自blog.csdn.net/weixin_41126842/article/details/84335414