banner
RustyNail

RustyNail

coder. 【blog】https://rustynail.me 【nostr】wss://ts.relays.world/ wss://relays.world/nostr

【CrudBoy的奇妙冒险】跑了一年的代码报错Invalid bound statement

跑了一年的代码报错。。。


022-11-10 17:22:19.628 [http-nio-60051-exec-6] ERROR c.g.p.e.ExceptionProcessHandler - Invalid bound statement (not found): xx业务Mapper.selectBatchIds

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): xx业务Mapper.selectBatchIds

	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)

	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:50)

	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedInvoker$0(MybatisMapperProxy.java:111)

	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)

	at com.baomidou.mybatisplus.core.toolkit.CollectionUtils.computeIfAbsent(CollectionUtils.java:115)

	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedInvoker(MybatisMapperProxy.java:98)

	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)

	at com.sun.proxy.$Proxy120.selectBatchIds(Unknown Source)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.lang.reflect.Method.invoke(Unknown Source)

	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)

	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)

	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)

	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

	at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:50)

	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)

	at com.sun.proxy.$Proxy121.selectBatchIds(Unknown Source)

原本的代码


@DS("xxxx")

public List<xx业务> getxx业务s(List<Long> uid) {

	return xx业务Mapper.selectBatchIds(uid);

}

可能原因

1.mapper.xml 里面的 namespace 与实际类不一样#

排查,一致

2.mapper 接口的函数名称和 mapper.xml 里面的标签 id 不一致#

selectBatchIds 是 com.baomidou.mybatisplus.core.mapper.BaseMapper<xx 业务> 的默认方法

修复的代码


@DS("xxxx")

public List<xx业务> getxx业务s(List<Long> uid) {

		return  xx业务Mapper.selectList(new LambdaQueryWrapper<xx业务>()

			.in(xx业务::getUid, uid)

	);

}
読み込み中...
文章は、創作者によって署名され、ブロックチェーンに安全に保存されています。