baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.33k stars 4.3k forks source link

自定义拦截器后,插入数据的时候替换Expressions导致参数和值的数量不一致 #4829

Closed Musll-T closed 2 years ago

Musll-T commented 2 years ago

当前使用版本(必填,否则不予处理)

3.5.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

image image

替换了Expressions后出现的

重现步骤(如果有就写完整)

替换了Expressions

报错信息

Could not set parameters for mapping: ParameterMapping{property='compId', mode=IN, javaType=class java.lang.Long, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #11 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 (11 > number of parameters, which is 10).

miemieYaho commented 2 years ago

给出你的复现demo

VampireAchao commented 2 years ago

因为这里的sql已经生成完毕了,所以修改了sql后,其parameterMapping未处理导致的,可参考下之前我写的一个:

https://github.com/apache/incubator-streampark/pull/1493/files

进行手动处理parameterMapping

Musll-T commented 2 years ago

因为这里的sql已经生成完毕了,所以修改了sql后,其parameterMapping未处理导致的,可参考下之前我写的一个:

https://github.com/apache/incubator-streampark/pull/1493/files

进行手动处理parameterMapping

好的,感谢