一、简介入门案例MyBatisPlus 主要是对 MyBatis 的简化MybatisPlus(简称 MP)是基于 MyBatis 框架基础上开发的增强型工具旨在简化开发、提高效率。开发方式基于 SpringBoot 使用 MyBatisPlusMyBatisPlus 的官网为:https://baomidou.com/introduce/2、入门案例step1:创建mybatisplus_db 数据库和user表、插入数据create database if not exists mybatisplus_db character set utf8; use mybatisplus_db; CREATE TABLE user ( id bigint(20) primary key auto_increment, name varchar(32) not null, password varchar(32) not null, age int(3) not null , tel varchar(32) not null ); insert into user values(1,Tom,tom,3,18866668888); insert into user values(2,Jerry,jerry,4,16688886666); insert into user values(3,Jock,123456,41,18812345678); insert into user values(4,程序员,sun,15,400000000);step2:创建 SpringBoot 工程step3:勾选配置使用技术step4:pom.xml 补全依赖dependency groupIdcom.baomidou/groupId artifactIdmybatis-plus-spring-boot3-starter/artifactId version3.5.14/version /dependency dependency groupIdcom.alibaba/groupId artifactIddruid/artifactId version1.1.16/version /dependencystep5:添加 MP 的相关配置信息step6:根据数据库表创建实体类step7:创建 mapper接口BaseMapper就像是一个提前写好的“万能工具包”里面装满了对单张数据库表进行增、删、改、查CRUD的现成方法。step8:编写引导类方案一:在 Mapper 接口上添加Mapper 注解并且确保 Mapper 处在引导类所在包或其子包中该方案的缺点是需要在每一 Mapper接口中添加注解方案二:在引导类上添加MapperScan 注解其属性为所要扫描的 Mapper 所在包该方案的好处是只需要写一次则指定包下的所有 Mapper 接口都能被扫描到Mapper 就可以不写。step9:编写测试类