岁数大了,学点东西该记笔记了,脑子越来越不好用。
1.配置POM.XML,引入MYBATIS依赖
<!-- mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
2.配置application.xml,(记得写那个classpath)
mybatis:
config-location: classpath:/mybatis/mybatis-config.xml
mapper-locations: classpath:/mybatis/mapper/*.xml
3.在resources下创建mybatis目录,在mybatis目录下创建mybatis-config.xml和mapper目录。
3.1 mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
</configuration>
3.2 *.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--对应我们新建的MAPPER接口-->
<mapper namespace="com.hyy.fileoa.mapper.FilelistMapper">
<!-- select 标签代表查询语句
id要与接口中的方法名一致 -->
<select id="findById" parameterType<