驱动用的是2.4.12版本,查询条件拼接sql如下,出现了数组越界问题,appidList 不传参没有问题,传参就出现下面这个问题
报错信息
Error querying database. Cause: java.lang.IndexOutOfBoundsException: Index: 0
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: SELECT count(0) AS total FROM test WHERE is_deleted = ‘N’ AND strategy_config_type = ? AND ( app_id LIKE '% ’ || ? || ‘%’) AND 1 = 0
Cause: java.lang.IndexOutOfBoundsException: Index: 0
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
判断条件:
<if appidList != null and appidList.size() > 0">
AND (
foreach collection=“appidList” item=“entity” separator=“OR”>”
app_id ‘%’ || #{entity} || ‘%’
/foreach>“
)