当前使用版本(必填,否则不予处理)
3.3.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
使用IPage进行自定义sql查询,参数使用Map方式,之前使用2.x版本一直这么写,没出现问题,升级到3.3.1后,查询报错, 使用IPage配合 @Param("name"),指定参数名称的形式没问题
重现步骤(如果有就写完整)
Mapper接口类似: List
xml 类似:
报错信息
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2] at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440) at com.sun.proxy.$Proxy76.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:177) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:78) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:96) at com.sun.proxy.$Proxy79.myPatientList(Unknown Source)
Comment From: miemieYaho
指定参数名
Comment From: justfeizai
我建议可以优化一下,现在只能拆开写,不能直接传map。(还有用条件构造器进行分页查询的时候,多个条件的时候分页插件也不好用了)