当前位置: 首页 > news >正文

SpringBoot(整合MyBatis + MyBatis-Plus + MyBatisX插件使用)

文章目录

    • 1.整合MyBatis
        • 1.需求分析
        • 2.数据库表设计
        • 3.数据库环境配置
          • 1.新建maven项目
          • 2.pom.xml 引入依赖
          • 3.application.yml 配置数据源
          • 4.Application.java 编写启动类
          • 5.测试
          • 6.配置类切换druid数据源
          • 7.测试数据源是否成功切换
        • 4.Mybatis基础配置
          • 1.编写映射表的bean
          • 2.MonsterMapper.java 编写mapper接口
          • 3.MonsterMapper.xml 编写mapper.xml实现mapper接口
          • 4.application.yml 扫描mapper.xml配置文件的位置
          • 5.测试
        • 5.MyBatis高级配置
          • 1.方式一:在application.yml中配置mybatis.config-location指定mybatis-config.xml配置文件的位置
          • 2.方式二:直接在application.yml中配置
        • 6.继续编写Service层和Controller层
          • 1.MonsterService.java
          • 2.MonsterServiceImpl.java
          • 3.测试
          • 4.MonsterController.java
          • 5.测试
          • 6.解决时间问题
        • 7.完整文件目录
    • 2.整合MyBatis-Plus
        • 1.MyBatis-Plus基本介绍
        • 2.数据库表设计
        • 3.数据库环境配置
          • 1.创建maven项目
          • 2.pom.xml 导入依赖
          • 3.application.yml 配置数据源
          • 4.DruidDataSourceConfig.java 配置类切换druid数据源
          • 5.编写启动类Application.java,测试运行
        • 4.MyBatis-Plus基础配置
          • 1.编写映射表的bean
          • 2.MonsterMapper.java 编写Mapper接口
          • 3.测试接口方法使用
        • 5.MyBatis-Plus高级配置
          • application.yml 进行配置
        • 6.继续编写Service层和Controller层
          • 1.MonsterService.java
          • 2.MonsterServiceImpl.java
          • 3.测试
          • 4.细节说明
          • 5.MonsterController.java
        • 7.细节说明
          • 1.@MapperScan 扫描包下的所有Mapper
            • 启动类配置注解
          • 2.@TableName bean的类名与表名不一致时使用
          • image-20240317200951971
          • 3.MyBatis引入了哪些依赖
        • 8.MyBatisX快速开发
          • 1.安装插件
          • 2.使用方式
            • 1.挑一个带小鸟的方法
            • 2.直接alt + Enter
            • 3.生成sql语句
            • 4.查看生成的方法
            • 5.点击左边的小鸟就可以直接跳转到指定方法或者xml
        • 9.完整文件目录
        • 10.MyBatis-Plus小结

1.整合MyBatis

1.需求分析

image-20240317110407816

2.数据库表设计
CREATE DATABASE `springboot_mybatis`;use `springboot_mybatis`;CREATE TABLE `monster` (`id` INT NOT NULL AUTO_INCREMENT,`age` INT NOT NULL, `birthday` DATE DEFAULT NULL, `email` VARCHAR(255) DEFAULT NULL,`gender` char(1) DEFAULT NULL,`name` VARCHAR(255) DEFAULT NULL, `salary` DOUBLE NOT NULL,PRIMARY KEY (`id`)
);SELECT * FROM `monster`;insert into monster values(null, 20, '2000-11-11', 'nmw@sohu.com', '男', '牛魔王', 5000.88);
insert into monster values(null, 10, '2011-11-11', 'bgj@sohu.com', '女', '白骨精', 2000.00);
3.数据库环境配置
1.新建maven项目

image-20240317111137777

2.pom.xml 引入依赖
    <!--导入springboot父工程--><parent><artifactId>spring-boot-starter-parent</artifactId><groupId>org.springframework.boot</groupId><version>2.5.3</version></parent><!--引入相关依赖--><dependencies><!--常规依赖--><!--web场景启动器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!--lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><!--引入测试场景启动器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!--配置处理器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><optional>true</optional></dependency><!--数据库配置--><!--引入data-jdbc数据源--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jdbc</artifactId></dependency><!--mysql依赖使用版本仲裁--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><!-- 引入 druid 依赖 --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.17</version></dependency><!--MyBatis场景启动器--><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.2.2</version></dependency></dependencies>
3.application.yml 配置数据源
  • 数据库名
  • 用户名
  • 密码
  • 驱动是mysql8的(因为上面使用了版本仲裁)
server:port: 8080
spring:datasource: #配置数据源url: jdbc:mysql://localhost:3306/springboot_mybatis?useSSL=false&useUnicode=true&characterEncoding=UTF-8username: rootpassword: rootdriver-class-name: com.mysql.cj.jdbc.Driver
4.Application.java 编写启动类
package com.sun.springboot.mybatis;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;/*** @author 孙显圣* @version 1.0*/
@SpringBootApplication
public class Application {public static void main(String[] args) {SpringApplication.run(Application.class, args);}
}
5.测试
package com.sun.springboot.mybatis;import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@SpringBootTest
public class ApplicationTest {//依赖注入@Resourceprivate JdbcTemplate jdbcTemplate;@Testpublic void t1() {//查看目前数据源System.out.println(jdbcTemplate.getDataSource().getClass());}
}

image-20240317135531900

6.配置类切换druid数据源
package com.sun.springboot.mybatis.config;import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Arrays;/*** @author 孙显圣* @version 1.0*/
@Configuration
public class DruidDataSourceConfig {//注入一个德鲁伊数据源@ConfigurationProperties("spring.datasource") //读取yaml配置文件的参数,获取数据源配置@Beanpublic DataSource dataSource() throws SQLException {DruidDataSource druidDataSource = new DruidDataSource();druidDataSource.setFilters("stat, wall"); //开启sql监控return druidDataSource;}//配置德鲁伊监控sql功能@Beanpublic ServletRegistrationBean statViewServlet() {StatViewServlet statViewServlet = new StatViewServlet();ServletRegistrationBean<StatViewServlet> registrationBean =new ServletRegistrationBean<>(statViewServlet, "/druid/*");//配置登录监控页面用户名和密码registrationBean.addInitParameter("loginUsername", "root");registrationBean.addInitParameter("loginPassword", "root");return registrationBean;}//配置webStatFilter@Beanpublic FilterRegistrationBean webStatFilter() {WebStatFilter webStatFilter = new WebStatFilter();FilterRegistrationBean<WebStatFilter> filterRegistrationBean =new FilterRegistrationBean<>(webStatFilter);//默认对所有 URL 请求监控filterRegistrationBean.setUrlPatterns(Arrays.asList("/*"));//排除 URLfilterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");return filterRegistrationBean;}
}
7.测试数据源是否成功切换
package com.sun.springboot.mybatis;import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@SpringBootTest
public class ApplicationTest {//依赖注入@Resourceprivate JdbcTemplate jdbcTemplate;@Testpublic void t1() {//查看目前数据源System.out.println(jdbcTemplate.getDataSource().getClass());}
}

image-20240317153854191

4.Mybatis基础配置
1.编写映射表的bean
package com.sun.springboot.mybatis.bean;import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;import java.util.Date;/*** @author 孙显圣* @version 1.0*/
@Data
public class Monster {private Integer id;private Integer age;@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")private Date birthday;private String email;private String name;private String gender;private Double salary;
}
2.MonsterMapper.java 编写mapper接口
  • 使用注解注入容器
package com.sun.springboot.mybatis.mapper;import com.sun.springboot.mybatis.bean.Monster;
import org.apache.ibatis.annotations.Mapper;/*** @author 孙显圣* @version 1.0*/
@Mapper //将接口注入容器
public interface MonsterMapper {public Monster getMonsterById(Integer id);
}
3.MonsterMapper.xml 编写mapper.xml实现mapper接口
  • 使用namespace指定要实现的接口
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--指定要实现的接口-->
<mapper namespace="com.sun.springboot.mybatis.mapper.MonsterMapper"><select id="getMonsterById" resultType="com.sun.springboot.mybatis.bean.Monster" parameterType="Integer">select * from monster where id = #{id}</select>
</mapper>

image-20240317160222655

4.application.yml 扫描mapper.xml配置文件的位置
  • 扫描类路径下mapper文件夹下的所有文件
mybatis:#指定要扫描的mapper.xmlmapper-locations: classpath:mapper/*.xml
5.测试
package com.sun.springboot.mybatis;import com.sun.springboot.mybatis.bean.Monster;
import com.sun.springboot.mybatis.mapper.MonsterMapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@SpringBootTest
public class ApplicationTest {//依赖注入@Resourceprivate JdbcTemplate jdbcTemplate;//注意这里注入的是MonsterMapper的代理对象@Resourceprivate MonsterMapper monsterMapper;@Testpublic void t1() {//查看目前数据源System.out.println(jdbcTemplate.getDataSource().getClass());}@Testpublic void t2() {//测试mybatisMonster monsterById = monsterMapper.getMonsterById(1);System.out.println(monsterById);}
}

image-20240317162322200

5.MyBatis高级配置
1.方式一:在application.yml中配置mybatis.config-location指定mybatis-config.xml配置文件的位置
2.方式二:直接在application.yml中配置
mybatis:#指定要扫描的mapper.xmlmapper-locations: classpath:mapper/*.xml#配置类型别名包,这样只要在这个包下的类型都可以简写type-aliases-package: com/sun/springboot/mybatis/bean#输出日志configuration:log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
6.继续编写Service层和Controller层
1.MonsterService.java
package com.sun.springboot.mybatis.service;import com.sun.springboot.mybatis.bean.Monster;/*** @author 孙显圣* @version 1.0*/
public interface MonsterService {public Monster getMonsterById(Integer id);
}
2.MonsterServiceImpl.java
package com.sun.springboot.mybatis.service.Impl;import com.sun.springboot.mybatis.bean.Monster;
import com.sun.springboot.mybatis.mapper.MonsterMapper;
import com.sun.springboot.mybatis.service.MonsterService;
import org.springframework.stereotype.Service;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@Service
public class MonsterServiceImpl implements MonsterService {@Resourceprivate MonsterMapper monsterMapper; //返回代理对象@Overridepublic Monster getMonsterById(Integer id) {return monsterMapper.getMonsterById(id);}
}
3.测试
package com.sun.springboot.mybatis;import com.sun.springboot.mybatis.bean.Monster;
import com.sun.springboot.mybatis.mapper.MonsterMapper;
import com.sun.springboot.mybatis.service.MonsterService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@SpringBootTest
public class ApplicationTest {//依赖注入@Resourceprivate MonsterService monsterService;@Testpublic void getMonsterById() {Monster monsterById = monsterService.getMonsterById(1);System.out.println(monsterById);}
}

image-20240317171924248

4.MonsterController.java
package com.sun.springboot.mybatis.Controller;import com.sun.springboot.mybatis.bean.Monster;
import com.sun.springboot.mybatis.service.MonsterService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@Controller
public class MonsterController {@Resourceprivate MonsterService monsterService;@GetMapping("/getMonster/{id}") //路径参数的请求@ResponseBody //响应一个jsonpublic Monster getMonsterById(@PathVariable("id") Integer id) {Monster monsterById = monsterService.getMonsterById(id);return monsterById;}
}
5.测试

image-20240317172341555

6.解决时间问题

image-20240317172733899

7.完整文件目录

image-20240317175408170

2.整合MyBatis-Plus

1.MyBatis-Plus基本介绍

image-20240317173128759

2.数据库表设计
CREATE DATABASE `springboot_mybatisplus`;USE `springboot_mybatisplus`;CREATE TABLE `monster` (
`id` INT NOT NULL AUTO_INCREMENT,
`age` INT NOT NULL, 
`birthday` DATE DEFAULT NULL, 
`email` VARCHAR(255) DEFAULT NULL, 
`gender` CHAR(1) DEFAULT NULL, 
`name` VARCHAR(255) DEFAULT NULL, 
`salary` DOUBLE NOT NULL,
PRIMARY KEY (`id`)
);
SELECT * FROM `monster`;
INSERT INTO monster VALUES(NULL, 20, '2000-11-11', 'xzj@sohu.com', '男', ' 蝎 子 精 ',
15000.88);
INSERT INTO monster VALUES(NULL, 10, '2011-11-11', 'ytj@sohu.com', '女', ' 玉 兔 精 ',
18000.88);
3.数据库环境配置
1.创建maven项目

image-20240317173858334

2.pom.xml 导入依赖
  <!--导入springboot父工程--><parent><artifactId>spring-boot-starter-parent</artifactId><groupId>org.springframework.boot</groupId><version>2.5.3</version></parent><!--引入相关依赖--><dependencies><!--常规依赖--><!--web场景启动器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!--lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><!--引入测试场景启动器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!--配置处理器--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><optional>true</optional></dependency><!--数据库配置--><!--mysql依赖使用版本仲裁--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><!-- 引入 druid 依赖 --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.17</version></dependency><!--引入MyBatis-Plus场景启动器,会自动引入jdbc和MyBatis--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.3</version></dependency></dependencies>
3.application.yml 配置数据源
  • 数据库名称
  • 用户名
  • 密码
server:port: 8080
spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/springboot_mybatisplus?useSSL=false&useUnicode=true&characterEncoding=UTF-8username: rootpassword: root
4.DruidDataSourceConfig.java 配置类切换druid数据源
package com.sun.springboot.mybatisplus.config;import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Arrays;/*** @author 孙显圣* @version 1.0*/
@Configuration
public class DruidDataSourceConfig {//注入一个德鲁伊数据源@ConfigurationProperties("spring.datasource") //读取yaml配置文件的参数,获取数据源配置@Beanpublic DataSource dataSource() throws SQLException {DruidDataSource druidDataSource = new DruidDataSource();druidDataSource.setFilters("stat, wall"); //开启sql监控return druidDataSource;}//配置德鲁伊监控sql功能@Beanpublic ServletRegistrationBean statViewServlet() {StatViewServlet statViewServlet = new StatViewServlet();ServletRegistrationBean<StatViewServlet> registrationBean =new ServletRegistrationBean<>(statViewServlet, "/druid/*");//配置登录监控页面用户名和密码registrationBean.addInitParameter("loginUsername", "root");registrationBean.addInitParameter("loginPassword", "root");return registrationBean;}//配置webStatFilter@Beanpublic FilterRegistrationBean webStatFilter() {WebStatFilter webStatFilter = new WebStatFilter();FilterRegistrationBean<WebStatFilter> filterRegistrationBean =new FilterRegistrationBean<>(webStatFilter);//默认对所有 URL 请求监控filterRegistrationBean.setUrlPatterns(Arrays.asList("/*"));//排除 URLfilterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");return filterRegistrationBean;}
}
5.编写启动类Application.java,测试运行
package com.sun.springboot.mybatisplus;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;/*** @author 孙显圣* @version 1.0*/
@SpringBootApplication
public class Application {public static void main(String[] args) {SpringApplication.run(Application.class, args);}
}

image-20240317175826043

4.MyBatis-Plus基础配置
1.编写映射表的bean
package com.sun.springboot.mybatisplus.bean;import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;import java.util.Date;/*** @author 孙显圣* @version 1.0*/
@Data
public class Monster {private Integer id;private Integer age;@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")private Date birthday;private String email;private String name;private String gender;private Double salary;
}
2.MonsterMapper.java 编写Mapper接口
package com.sun.springboot.mybatisplus.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sun.springboot.mybatisplus.bean.Monster;
import org.apache.ibatis.annotations.Mapper;/*** @author 孙显圣* @version 1.0*/
//直接继承BaseMapper接口
@Mapper //注入容器
public interface MonsterMapper extends BaseMapper<Monster> {//如果提供的方法不够用再自定义方法
}
3.测试接口方法使用
package com.sun.springboot.mybatisplus;import com.sun.springboot.mybatisplus.bean.Monster;
import com.sun.springboot.mybatisplus.mapper.MonsterMapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@SpringBootTest
public class MonsterMapperTest {//注入针对Mapper接口的代理对象@Resourceprivate MonsterMapper monsterMapper;@Testpublic void t1() {Monster monster = monsterMapper.selectById(1);System.out.println(monster);}
}

image-20240317181409483

5.MyBatis-Plus高级配置
application.yml 进行配置
#进行mybatis-plus配置
mybatis-plus:configuration:log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
6.继续编写Service层和Controller层
1.MonsterService.java
package com.sun.springboot.mybatisplus.service.Impl;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.springboot.mybatisplus.bean.Monster;
import com.sun.springboot.mybatisplus.mapper.MonsterMapper;
import com.sun.springboot.mybatisplus.service.MonsterService;
import org.springframework.stereotype.Service;/*** 这里* @author 孙显圣* @version 1.0*/
@Service
public class MonsterServiceImpl extends ServiceImpl<MonsterMapper, Monster> implements MonsterService {//自定义方法实现
}
2.MonsterServiceImpl.java
package com.sun.springboot.mybatisplus.service.Impl;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.springboot.mybatisplus.bean.Monster;
import com.sun.springboot.mybatisplus.mapper.MonsterMapper;
import com.sun.springboot.mybatisplus.service.MonsterService;
import org.springframework.stereotype.Service;/*** 这里* @author 孙显圣* @version 1.0*/
@Service
public class MonsterServiceImpl extends ServiceImpl<MonsterMapper, Monster> implements MonsterService {//自定义方法实现
}
3.测试
package com.sun.springboot.mybatisplus;import com.sun.springboot.mybatisplus.bean.Monster;
import com.sun.springboot.mybatisplus.mapper.MonsterMapper;
import com.sun.springboot.mybatisplus.service.MonsterService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@SpringBootTest
public class MonsterServiceTest {@Resourceprivate MonsterService monsterService;@Testpublic void t1() {Monster byId = monsterService.getById(2);System.out.println(byId);}
}

image-20240317193644393

4.细节说明
  • 简单来说就是MonsterServiceImpl只需要实现MonsterService接口的方法
  • 可以调用IService接口的方法,也可以调用MonsterService接口的方法

image-20240317193513003

5.MonsterController.java
package com.sun.springboot.mybatisplus.controller;import com.sun.springboot.mybatisplus.bean.Monster;
import com.sun.springboot.mybatisplus.service.MonsterService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;import javax.annotation.Resource;/*** @author 孙显圣* @version 1.0*/
@Controller
public class MonsterController {@Resource//注入的是MonsterServiceImpl的bean对象,可以直接调用IService接口的方法private MonsterService monsterService;@GetMapping("/getMonster/{id}")@ResponseBodypublic Monster getMonsterById(@PathVariable("id") Integer id) {Monster byId = monsterService.getById(id);return byId;}
}

image-20240317194934543

7.细节说明
1.@MapperScan 扫描包下的所有Mapper
启动类配置注解

image-20240317200417488

2.@TableName bean的类名与表名不一致时使用
image-20240317200951971
3.MyBatis引入了哪些依赖

image-20240317201044828

8.MyBatisX快速开发
1.安装插件

image-20240317201658927

2.使用方式
1.挑一个带小鸟的方法

image-20240317203048085

2.直接alt + Enter

image-20240317203124474

3.生成sql语句

image-20240317203146538

4.查看生成的方法

image-20240317203209726

5.点击左边的小鸟就可以直接跳转到指定方法或者xml

image-20240317203629654

image-20240317203639228

9.完整文件目录

image-20240317203723886

10.MyBatis-Plus小结

image-20240317203958723

相关文章:

SpringBoot(整合MyBatis + MyBatis-Plus + MyBatisX插件使用)

文章目录 1.整合MyBatis1.需求分析2.数据库表设计3.数据库环境配置1.新建maven项目2.pom.xml 引入依赖3.application.yml 配置数据源4.Application.java 编写启动类5.测试6.配置类切换druid数据源7.测试数据源是否成功切换 4.Mybatis基础配置1.编写映射表的bean2.MonsterMapper…...

GAMES104-现代游戏引擎 1

主要学习重点还是面向就业&#xff0c;重点复习八股和算法 每天早上八点到九点用来学习这个课程 持续更新中... 第一节 游戏引擎导论 第二节 引擎架构分层 引擎是分层架构的 编辑器功能层资源层核心层平台层 越底层的代码越稳定越坚固&#xff0c;越上层的代码越灵活越开…...

idea 开发serlvet篮球秩序册管理系统idea开发mysql数据库web结构计算机java编程layUI框架开发

一、源码特点 idea开发 java servlet 篮球秩序册管理系统是一套完善的web设计系统mysql数据库 系统采用serlvetdaobean mvc 模式开发&#xff0c;对理解JSP java编程开发语言有帮助&#xff0c;系统具有完整的源代码和数据库&#xff0c;系统主要采用B/S模式开发。 servlet 篮…...

【深度学习】NestedTensors

文章目录 NestedTensorsWhy NestedTensor初始化 NestedTensorNestedTensor 操作reshape转置查看维度其他 NestedTensors DETR 中常见的数据格式为 NestedTensors&#xff0c;那么什么是 NestedTensors 呢&#xff1f; NestedTensor&#xff0c;包括 tensor 和 mask 两个成员&a…...

【网络】负载均衡

OSI模型每一层的负载均衡 在OSI模型中&#xff0c;每一层的负载均衡具体如下&#xff1a; 1. 第二层&#xff08;数据链路层&#xff09;&#xff1a;数据链路层的负载均衡通常涉及对MAC地址的操作。在这一层&#xff0c;可以使用虚拟MAC地址技术&#xff0c;外部设备对虚拟MA…...

dataGridView 绑定List 显示内容不刷新

绑定后,原list值变动,显示内容会刷新 绑定后,list新添加的值时不会显示到界面,需要重新绑定list 微软的Bug 参考代码 public class Student{public string Name { get; set; }}List<Student> list new List<Student>();private void Form2_Load(object sender,…...

VR历史建筑漫游介绍|虚拟现实体验店|VR设备购买

VR历史建筑漫游是一种利用虚拟现实技术&#xff0c;让用户可以身临其境地参观和探索历史建筑的体验。通过VR头显和相关设备&#xff0c;用户可以在虚拟环境中自由移动和互动&#xff0c;感受历史建筑的真实氛围和文化内涵。 在VR历史建筑漫游中&#xff0c;您可以选择不同的历史…...

Linux查看硬件型号详细信息

1.查看CPU &#xff08;1&#xff09;使用cat /proc/cpuinfo或lscpu &#xff08;2&#xff09;使用dmidecode -i processor Dmidecode 这款软件允许你在 Linux 系统下获取有关硬件方面的信息。Dmidecode 遵循 SMBIOS/DMI 标准&#xff0c;其输出的信息包括 BIOS、系统、主板、…...

【鸿蒙HarmonyOS开发笔记】通知模块之发布基础类型通知,内含如何将图片变成PixelMap对象

通知简介 应用可以通过通知接口发送通知消息&#xff0c;终端用户可以通过通知栏查看通知内容&#xff0c;也可以点击通知来打开应用。 通知常见的使用场景&#xff1a; 显示接收到的短消息、即时消息等。 显示应用的推送消息&#xff0c;如广告、版本更新等。 显示当前正…...

外包干了1个月,技术明显进步。。。

我是一名大专生&#xff0c;自19年通过校招进入湖南某软件公司以来&#xff0c;便扎根于功能测试岗位&#xff0c;一晃便是近四年的光阴。今年8月&#xff0c;我如梦初醒&#xff0c;意识到长时间待在舒适的环境中&#xff0c;已让我变得不思进取&#xff0c;技术停滞不前。更令…...

鸿蒙开发实战:【Faultloggerd部件】

theme: z-blue 简介 Faultloggerd部件是OpenHarmony中C/C运行时崩溃临时日志的生成及管理模块。面向基于 Rust 开发的部件&#xff0c;Faultloggerd 提供了Rust Panic故障日志生成能力。系统开发者可以在预设的路径下找到故障日志&#xff0c;定位相关问题。 架构 Native In…...

蓝桥杯刷题|03普及-真题

[蓝桥杯 2017 省 B] k 倍区间 题目描述 给定一个长度为 N 的数列&#xff0c;​,,⋯&#xff0c;如果其中一段连续的子序列 ​,,⋯ (i≤j) 之和是 K 的倍数&#xff0c;我们就称这个区间 [i,j] 是 K 倍区间。 你能求出数列中总共有多少个 K 倍区间吗&#xff1f; 输入格式 …...

【动态三维重建】Deformable 3D Gaussians 可变形3D GS用于单目动态场景重建(CVPR 2024)

主页&#xff1a;https://ingra14m.github.io/Deformable-Gaussians/ 代码&#xff1a;https://github.com/ingra14m/Deformable-3D-Gaussians 论文&#xff1a;https://arxiv.org/abs/2309.13101 文章目录 摘要一、前言二、相关工作2.1 动态场景的神经渲染2.2 神经渲染加速 三…...

智能驾驶域控制器行业介绍

汽车智能驾驶功能持续高速渗透&#xff0c;带来智能驾驶域控制器市场空间快速增 长。智驾域控制器是智能驾驶决策环节的重要零部件&#xff0c;主要功能为处理感知 信息、进行规划决策等。其核心部件主要为计算芯片&#xff0c;英伟达、地平线等芯 片厂商市场地位突出。随着消费…...

[数据集][目标检测]焊接件表面缺陷检测数据集VOC+YOLO格式2292张10类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;2292 标注数量(xml文件个数)&#xff1a;2292 标注数量(txt文件个数)&#xff1a;2292 标注…...

微信小程序的页面制作---常用组件及其属性

微信小程序里的组件就是html里的标签&#xff0c;但其组件都自带UI风格和特定的功能效果 一、常用组件 view&#xff08;视图容器&#xff09;、text&#xff08;文本&#xff09;、button&#xff08;按钮&#xff09;、image&#xff08;图片&#xff09;、form&#xff08…...

什么样的网站不适合使用WordPress?

WordPress作为全球应用最广泛的CMS系统&#xff0c;很好很强大&#xff0c;被从多的网站使用。但是&#xff0c;也不是所有的网站。下面简站WP小编从自己多年WordPress建站经验的角度&#xff0c;给大家讲讲&#xff0c;有哪些网站不适合使用WordPress搭建。 1、功能特别多的功…...

vulhub中GitLab 任意文件读取漏洞复现(CVE-2016-9086)

GitLab是一款Ruby开发的Git项目管理平台。在8.9版本后添加的“导出、导入项目”功能&#xff0c;因为没有处理好压缩包中的软连接&#xff0c;已登录用户可以利用这个功能读取服务器上的任意文件。 环境运行后&#xff0c;访问http://your-ip:8080即可查看GitLab主页&#xff0…...

【爬虫】web自动化和接口自动化

专栏文章索引&#xff1a;爬虫 目录 一、介绍 二、推荐 1.接口自动化 2.Web自动化 一、介绍 爬虫技术一般可以分为两种类型&#xff1a;接口自动化和web自动化。下面是它们的简要介绍&#xff1a; 1.接口自动化 接口自动化技术的主要目的是通过模拟HTTP请求来实现自动化…...

哔哩哔哩后端Java一面

前言 作者&#xff1a;晓宜 个人简介&#xff1a;互联网大厂Java准入职&#xff0c;阿里云专家博主&#xff0c;csdn后端优质创作者&#xff0c;算法爱好者 最近各大公司的春招和实习招聘都开始了&#xff0c;这里分享下去年面试B站的的一些问题&#xff0c;希望对大家有所帮助…...

【Oracle APEX开发小技巧12】

有如下需求&#xff1a; 有一个问题反馈页面&#xff0c;要实现在apex页面展示能直观看到反馈时间超过7天未处理的数据&#xff0c;方便管理员及时处理反馈。 我的方法&#xff1a;直接将逻辑写在SQL中&#xff0c;这样可以直接在页面展示 完整代码&#xff1a; SELECTSF.FE…...

深入理解JavaScript设计模式之单例模式

目录 什么是单例模式为什么需要单例模式常见应用场景包括 单例模式实现透明单例模式实现不透明单例模式用代理实现单例模式javaScript中的单例模式使用命名空间使用闭包封装私有变量 惰性单例通用的惰性单例 结语 什么是单例模式 单例模式&#xff08;Singleton Pattern&#…...

《通信之道——从微积分到 5G》读书总结

第1章 绪 论 1.1 这是一本什么样的书 通信技术&#xff0c;说到底就是数学。 那些最基础、最本质的部分。 1.2 什么是通信 通信 发送方 接收方 承载信息的信号 解调出其中承载的信息 信息在发送方那里被加工成信号&#xff08;调制&#xff09; 把信息从信号中抽取出来&am…...

华为云Flexus+DeepSeek征文|DeepSeek-V3/R1 商用服务开通全流程与本地部署搭建

华为云FlexusDeepSeek征文&#xff5c;DeepSeek-V3/R1 商用服务开通全流程与本地部署搭建 前言 如今大模型其性能出色&#xff0c;华为云 ModelArts Studio_MaaS大模型即服务平台华为云内置了大模型&#xff0c;能助力我们轻松驾驭 DeepSeek-V3/R1&#xff0c;本文中将分享如何…...

OPenCV CUDA模块图像处理-----对图像执行 均值漂移滤波(Mean Shift Filtering)函数meanShiftFiltering()

操作系统&#xff1a;ubuntu22.04 OpenCV版本&#xff1a;OpenCV4.9 IDE:Visual Studio Code 编程语言&#xff1a;C11 算法描述 在 GPU 上对图像执行 均值漂移滤波&#xff08;Mean Shift Filtering&#xff09;&#xff0c;用于图像分割或平滑处理。 该函数将输入图像中的…...

接口自动化测试:HttpRunner基础

相关文档 HttpRunner V3.x中文文档 HttpRunner 用户指南 使用HttpRunner 3.x实现接口自动化测试 HttpRunner介绍 HttpRunner 是一个开源的 API 测试工具&#xff0c;支持 HTTP(S)/HTTP2/WebSocket/RPC 等网络协议&#xff0c;涵盖接口测试、性能测试、数字体验监测等测试类型…...

Webpack性能优化:构建速度与体积优化策略

一、构建速度优化 1、​​升级Webpack和Node.js​​ ​​优化效果​​&#xff1a;Webpack 4比Webpack 3构建时间降低60%-98%。​​原因​​&#xff1a; V8引擎优化&#xff08;for of替代forEach、Map/Set替代Object&#xff09;。默认使用更快的md4哈希算法。AST直接从Loa…...

【Android】Android 开发 ADB 常用指令

查看当前连接的设备 adb devices 连接设备 adb connect 设备IP 断开已连接的设备 adb disconnect 设备IP 安装应用 adb install 安装包的路径 卸载应用 adb uninstall 应用包名 查看已安装的应用包名 adb shell pm list packages 查看已安装的第三方应用包名 adb shell pm list…...

【Linux系统】Linux环境变量:系统配置的隐形指挥官

。# Linux系列 文章目录 前言一、环境变量的概念二、常见的环境变量三、环境变量特点及其相关指令3.1 环境变量的全局性3.2、环境变量的生命周期 四、环境变量的组织方式五、C语言对环境变量的操作5.1 设置环境变量&#xff1a;setenv5.2 删除环境变量:unsetenv5.3 遍历所有环境…...

AI语音助手的Python实现

引言 语音助手(如小爱同学、Siri)通过语音识别、自然语言处理(NLP)和语音合成技术,为用户提供直观、高效的交互体验。随着人工智能的普及,Python开发者可以利用开源库和AI模型,快速构建自定义语音助手。本文由浅入深,详细介绍如何使用Python开发AI语音助手,涵盖基础功…...