确认

  • [ ] 我使用的版本是最新版, 并且使用插件确认过项目里无依赖版本冲突
  • [x] 我已经在 issue 中搜索过, 确认问题没有被提出过
  • [x] 我已经修改标题, 将标题中的 描述 替换为遇到的问题(不得删除 描述 前面的部分)

当前程序版本

3.5.9

问题描述

3.5.9 版本,分页插件在自动生成 count查询时,只拼接了一个条件,但是拼接了多个参数,导致占位符数量不对,报错

详细堆栈日志

The error may involve defaultParameterMap\r\n### The error occurred while setting parameters\r\n### SQL: SELECT COUNT(*) AS total FROM xcesc_order xo WHERE xo.or_deleted = 0 AND (xo.created_by IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) OR xo.car_source_id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))\r\n### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='param.nameOrPhone', 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 #55 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 #55 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 (55 > number of parameters, which is 54).",
  "data": null

Comment From: miemieYaho

git形式给出你的复现demo

Comment From: dreamonlyone

配合分页查询时才会报错,不分页不报错,或者不使用占位符#而使用拼接符$也不报错 。报错案例:
select XXX from product_spu a where a.is_available = 1 and a.is_put_on_sale=1 ---if test=" vo.tagId != null and vo.tagId != ''"--- and EXISTS ( select 1 from product_spu_tag t where t.spu_id = a.spu_id and t.tag_id = #{vo.tagId} ) 接口List selectProductSpuPage(Page page, ProductSpuVo vo); 报错内容: Parameter index out of range (1 > number of parameters, which is 0).