报错信息:
ERROR [http-nio-8080-exec-15] 2020-08-05 09:21:01 (GlobalExceptionHandler.java:194) 运行时异常:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.jxdinfo.mes.file.dao.TreeFileMapper.deleteFile
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49) ~[mybatis-3.4.6.jar:3.4.6]
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65) ~[mybatis-3.4.6.jar:3.4.6]
检查:
- 接口中方法名xxx与xml文件中 id="xxx"是否一致
- xml文件中的 namespace=“xxx.xxx.xxx.Mapper” 中的路径是否与接口文件路径一致
- parameterType类型 与 resultType类型是否准确
看报错信息,问题出在Mapper上
找了好几圈才发现,把 delete 语句的 id 写错了=_=
<!--删除文件信息-->d
<delete id="deleteFile">
<if test="id != null ">
DELETE FROM file
WHERE id = #{id}
</if>
</delete>