问题遇到的现象和发生背景
一个简单而又找不到的问题
一直显示Invalid bound statement (not found)错误
这个错误是dao接口和mapper映射之间的错误,一直未找到
问题相关代码,请勿粘贴截图
dao接口层
@Mapper
@Repository
public interface TUserDao {
int deleteByPrimaryKey(Integer id);
int insert(TUser record);
int insertSelective(TUser record);
TUser selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TUser record);
int updateByPrimaryKey(TUser record);
TUserDao.xml
<mapper namespace="com.uu.demo04.dao.TUserDao">
<resultMap id="BaseResultMap" type="com.uu.demo04.pojo.TUser">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="age" jdbcType="INTEGER" property="age" />
</resultMap>
<sql id="Base_Column_List">
id, `name`, age
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_user
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from t_user
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.uu.demo04.pojo.TUser" useGeneratedKeys="true">
insert into t_user (`name`, age)
values (#{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER})
</insert>
</mapper>
application.properties配置
server.port=9999
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql://localhost:3306/springboot-test?useUnicode=true&characterEncoding=utf8&serverTimeZone=UTC&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
mybatis.type-aliases-package=com.uu.demo04.pojo
mybatis.mapper-locations=classpath=mapper/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
运行结果及报错内容
Invalid bound statement (not found)
有点离谱的错误 好微小 但找不到
项目结构图