后端技术
未读
springboot报错——Field userMapper in xx.xx required a bean of type 'xx.mapper' that could not be found.
报错内容 Description:
Field userMapper in com.zxb.boot3.ssm.controller.UserController required a bean of type 'com.zxb.boot3.ssm.mapper.UserMapper' that
后端技术
未读
MyBatis笔记——MyBatis缓存
什么是MyBatis缓存 当 mybatis 执行sql时,会创建缓存,下次执行相同语句时,会直接使用缓存的结果 优点 减少重复sql的计算时间 MyBatis 一级缓存 一级缓存是SqlSession级别的 SqlSession sqlSession = SqlSessionUtils.getSq
后端技术
未读
MyBatis——动态SQL
什么是动态SQL 动态SQL是MyBatis中的一种功能,允许你在XML映射文件中编写动态生成的SQL语句。主要用于解决SQL语句需要根据不同情况进行变化的问题。 例如,你可能需要根据用户输入的查询条件生成不同的where子句,或者可能需要根据程序运行时的状态切换不同的join子句等。 MyBati
后端技术
未读
MyBatis笔记——一对多参映射问题解决
场景重现 当想要查询一个部门下的所有员工时,一个部门 对应 多个员工 实验使用的类和对象 mapper.xml: <select id="getEmpAndDept" resultMap="empAndDeptResultMapTwo">
select
后端技术
未读
MyBatis笔记——多对一映射问题解决
场景重现 当想要查询一个员工的所在部门,一个员工 对应一个部门 实验使用的类和对象 mapper.xml: <select id="getEmpAndDept" resultMap="empAndDeptResultMapTwo">
select * f
后端技术
未读
MyBatis笔记——参数处理
占位符 MyBatis 中,想要读取 mapper方法中的形参,占位符分为两种:${} 和 #{}。 ${} ${} 是使用 字符串拼接的方式进行占位 mapper User selectUserById(int id);
mapper.xml <select id="selectUserById
后端技术
未读
MyBatis笔记——mybatis核心配置文件
核心配置文件详解 <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"https://my
后端技术
未读
MyBatis笔记——mybatis配置基础环境
配置步骤 1. 引入pom依赖 <dependencies>
<!--MyBatis核心依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</art