文件的创建:
https://blog.csdn.net/weixin_43304253/article/details/125047008

1、目录结构

2、新增配置

@Configuration
//扫描mapper接口所在的包
@MapperScan("com.zyz.mybatisplus.mapper")
public class MyBatisPlusConfig { @Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
} }

3、编写测试类

@SpringBootTest
public class MyBatisPlusPluginsTest { @Autowired
private UserMapper userMapper; @Test
public void testPage(){
Page<User> page = new Page<>(2,3);
userMapper.selectPage(page,null);
System.out.println(page.getRecords());
System.out.println(page.getPages());
System.out.println(page.getTotal());
System.out.println(page.hasNext());
System.out.println(page.hasPrevious()); } }

4、测试结果

5、数据库中的表

MyBatisPlus分页插件在SpringBoot中的使用的更多相关文章

  1. mybatis-plus分页插件

    package com.tanhua.server.config; import com.baomidou.mybatisplus.extension.plugins.PaginationInterc ...

  2. Mybatisplus分页插件的使用

    一.加依赖: <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus ...

  3. spring-boot分页插件

    1.分页插件,spring-boot.,第一次调用时,存值到 model.addAttribute("status", id);页面获取2.页面获取 后台存入的值,放在input ...

  4. SpringBoot+MyBatis多数据源使用分页插件PageHelper

    之前只用过单数据源下的分页插件,而且几乎不用配置.一个静态方法就能搞定. PageHelper.startPage(pageNum, pageSize); 后来使用了多数据源(不同的数据库),Page ...

  5. 若依3.6.0使用Mybatis-plus分页失效以及完美替换Pagehelper

    一.前言 小编最近在经历后端框架的迁移,虽然不是小编来做,但是有个分页的情况让小编和一个同事去搞. 说一下小编这边的需求: 原来框架使用Mybatis-plus进行分页,要更换的新框架若依是使用Pag ...

  6. Mybatis分页插件pagehelper的使用

    加入依赖 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pageh ...

  7. MyBatis-编写自定义分页插件

    一.基础知识 本文测试和源码分析参考版本: Mybatis-version:3.5.5 本文相关测试源代码:https://github.com/wuya11/mybatis_demo 1.1 参考方 ...

  8. springboot中使用mybatisplus自带插件实现分页

    springboot中使用mybatisplus自带插件实现分页 1.导入mybatisplus分页依赖 <dependency> <groupId>com.baomidou& ...

  9. SpringBoot集成PageHelper时出现“在系统中发现了多个分页插件,请检查系统配置!”

    近日在项目中使用SpringBoot集成PageHelper后,跑单元测试时出现了"在系统中发现了多个分页插件,请检查系统配置!"这个问题. 如下图所示: org.mybatis. ...

随机推荐

  1. Charles 某音最新版本抓包环境搭建

    本文仅供学习交流使用,如侵立删! Charles 某音最新版本抓包环境搭建 操作环境 google nexus5x Android 8.1 Magisk 24.3 Douyin 17.3 kaliLi ...

  2. 使用 Vagrant 在 VirtualBox 安装 Linux 虚拟机

    GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 目录 1. 导入 2.工具介绍 3.通过Vagrant为VirtualBox安装CentOS 7 4.总结 文章推荐: 关 ...

  3. Luogu3855 [TJOI2008]Binary Land (BFS)

    #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> ...

  4. 【Java】学习路径57-TCP协议客户端与服务器端的关闭

    在TCP协议中,如果发送端(客户端)关闭了,那么接收端(服务器端)端就会收到这个消息. 那么接收端(服务器端)怎么知道的呢? 我们进行实验: 首先在发送端中编写一段程序,当用户输入"end& ...

  5. Typora多线程批量上传图片,永久免费25G图床

    为了满足日常需求,就写了一个自动上传图片到图床的脚本 运行该程序可以做到自动完成图片上传,并自动替换为网络链接,支持多图同时上传,采用了多线程,上传速度提升很明显. 以Window系统为例,操作步骤: ...

  6. Windows平台摄像头或屏幕RTMP推送介绍:OBS VS SmartPublisher

    好多开发者问道,既然有了OBS,你们为什么还要开发SmartPublisher? 的确,在我们进行Windows平台RTMP推送模块开发之前,市面上为数不多的Windows平台RTMP推流工具当属OB ...

  7. gin如何多次shoubind一个请求参数

    gin多次绑定请求参数 package main import ( "fmt" "net/http" "time" "github ...

  8. torch.stack()与torch.cat()

    torch.stack():http://www.45fan.com/article.php?aid=1D8JGDik5G49DE1X torch.stack()个人理解:属于先变形再cat的操作,所 ...

  9. java 类名后加变量名是什么意思?

    回答这个问题我们需要先了解两个事情: A是一个类,我们如果对他进行实例化,需要这样写: A a = new A(); 详细解释一下这个语句,首先等号左边做的事情:在JVM栈内存(stack)中定义了一 ...

  10. 彻底掌握Makefile(二)

    彻底掌握Makefile(二) 前言 在前面的文章彻底掌握Makefile(一)当中,我们简要的介绍了一些常见的makefile使用方法,在本篇文章当中我们将继续介绍一些makefile当中的常见用法 ...