org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.jvtd.operation.lightCloud.product.mapper.ProductMapper.selectPagedProductList

看到这个错误,肯定是mybatis抛出的异常,意思是:mapper的xml文件没有selectPagedProductList这个方法,说说排查步骤

1.首先看下mapper.xml文件的中

<mapper namespace="com.jvtd.operation.auth.mapper.AuthFuncMapper"> 是否只想对应的mapper,这个地方我举例子用的是AuthFuncMapper

2.在看看mapper.xml文件中selectPagedProductList,这个方法相关resultMap还是resultType,

parameterType等是否正确

3.检查下xml文件是否被spring扫描到了,我是springboot的项目,

在application文件中配置的是

mybatis-plus.mapper-locations=classpath:classpath:com/jvtd/operation/lightCloud/*/mapper/xml/*Mapper.xml

我的问题是:mybatis-plus.mapper-locations=classpath:classpath:com/jvtd/operation/lightCloud/*/mapper/xml/*Mapper.xml有问题,xml没有被扫描到,犯这么低级的错误是因为,(之前的配置:classpath:com/jvtd/operation/*/mapper/xml/*Mapper.xm),*是代表很多包,那么同一层级所有包都是可以被扫描到的,但是,其中lightCloud下面有子包,就扫描不到了,最后改成了mybatis-plus.mapper-locations=classpath:com/jvtd/operation/*/mapper/xml/*Mapper.xml,classpath:com/jvtd/operation/lightCloud/*/mapper/xml/*Mapper.xml