小白提升日记 2022-07-15 17:57 采纳率: 69.2%
浏览 40
已结题

dao接口和mapper映射看代码

问题遇到的现象和发生背景

一个简单而又找不到的问题
一直显示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)
有点离谱的错误 好微小 但找不到

项目结构图

img

  • 写回答

2条回答 默认 最新

  • 原来我不知道啊 2022-07-15 18:37
    关注

    mybatis.mapper-locations的值错了,classpath后面应该是冒号,不是等号

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 8月1日
  • 已采纳回答 7月24日
  • 修改了问题 7月15日
  • 创建了问题 7月15日

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条