Caused by: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0

1、 Error analysis

It can be seen from the error prompt that the actual parameters passed in are larger than the parameters to be set in SQL, that is, the parameters in SQL?Less than parameter or?There is no
cause at all

? The number is surrounded by single quotation marks

For example:

sql += " and article_title like '%#{articleTitle}%'";

2、 Solutions

Remove single quotes

The above SQL is changed to:

sql += " and article_title like concat('%',#{articleTitle},'%')";

Read More: