一、正确的方式:

@Select("select * from `test`.loan_link where link_name like concat('%',#{linkName},'%') order by add_time desc") 
List
<LoanLinkEntity> queryByLinkName(@Param("linkName") String linkName);

运行正常,能够模糊查询

二、采用下面的方式报错

 @Select("select * from `test`.loan_link where link_name like '%#{linkName}%' order by add_time desc")
    List<LoanLinkEntity> queryByLinkName(@Param("linkName") String linkName);

运行结果:

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

 

相关文章:

  • 2021-09-02
  • 2022-12-23
  • 2022-01-31
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案