当前使用版本(必填,否则不予处理)
3.4.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
自定义mybatis 拦截器拦截并修改sql,调用mybatis-plus updateBatchById 批量更新操作时,自定义拦截器只拦截第一条更新语句并将修改后的sql传入mybatis-plus 的mybatisParamHandler中,但后续的更新sql,并未先进入自定义拦截器,而是直接在mybatis-plus 的mybatisParamHandler中执行。
重现步骤(如果有就写完整)
① 自定义拦截器修改sql,可以随便加个字段更新 ② 调用mybatis-plus的updateBatchById方法, 保证数据量大于1
报错信息
在批量更新第二条数据时报错 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='et.identityId', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
Comment From: Li-Menglong
anybody?
Comment From: VampireAchao
可以尝试升级到最新版,尽量提供代码复现