1.什么是MybatisXMybatisX 是一款基于 IDEA 的快速开发插件方便在使用mybatis以及mybatis-plus开始时简化繁琐的重复操作提高开发速率。2.使用MybatisX的好处节省大量持久层代码开发时间强大的功能为业务编写提供各类支持配置简单告别各类复杂的配置文件3.如何使用MybatisX?1.创建一个简单的数据库2.创建一个简单的Springboot工程3.在pom.xml文件中引入mybatis-plus依赖!--mybatisPlus-- dependency groupIdcom.baomidou/groupId artifactIdmybatis-plus-boot-starter/artifactId version3.5.1/version /dependency推荐一个开源免费的 Spring Boot 最全教程https://github.com/javastacks/spring-boot-best-practice4.在File-Settings-Plugins下载MybatiX插件5.两下SHIFT键搜索database进入数据库6.新建Mysql连接当Test Connection时会提示这么一段话这是时区未设置问题根据提示来到Advanced找到severTimezone将其设置为GMT(Greenwich Mean Time格林尼治标准时间)此时再测试连接会发现已经成功这时候我们就可以看见我们想要连接的数据库和其对应的表等信息了右键对应的表我们可以看到MybatiX-Generator点击后我们会看到这样一个页面我们可以在这个页面中设置需要消除的前后缀、文件存放目录等...点击Next在下面是一些配置我们勾选Mybatis-Plus的最新版本Mybatix-Plus 3 和 简化开发的Lombok点击Finish我们可以看到MybatisX为我们自动生成了该表对应的实体类、Mapper文件、Service和相对应的接口在yaml中对数据库进行配置application.yamlspring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/user?characterEncodingutf-8useSSLfalseserverTimezoneGMT username: root password: password控制层编写方法使用到Mybatis-Plus中的条件构造器package com.example.mybatixtest.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.example.mybatixtest.pojo.User; import com.example.mybatixtest.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; RestController public class TestController { Autowired UserService userService; GetMapping(/test) public User test(){ QueryWrapperUser userQueryWrapper new QueryWrapper(); userQueryWrapper.eq(user_id,1); User user userService.getOne(userQueryWrapper); return user; } }访问成功