Mybatis报错(九)| nested exception is org.apache.ibatis.binding.BindingException:

193 阅读1分钟

微信公众号:秀基宝。如有问题,请后台留言,反正我也不会听。

前言

最近碰到一个报错,mybatis查询报错,记录一下

2023-08-04 11:18:41.865 [http-nio-8081-exec-10] [1687302007439130624] [ERROR] [com.vivo.testone.config.ExceptionHandlerConfig][POST][/bug_measurement/list_bug_data] - ExceptionHandlerConfig -system exception 
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'ruleConcatStr' not found. Available parameters are [param1, req]
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
	at com.sun.proxy.$Proxy173.selectList(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:173)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:78)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
	at com.sun.proxy.$Proxy490.getWmBugByParams(Unknown Source)

解决

其实从日志看得出来,查询时候,参数ruleConcatStr没有req前缀,这个时候写if判断什么时候一定要和注解里面@Param一致

作者:秀基宝
链接:juejin.cn/post/711747…
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。