SpringBoot下使用mybatis注解方式进行模糊查询时发生错误,结果报错:Parameter index out of range (1 > number of parameters, which is 0);
这里是错误示例:
“select * from user where name like “%#{name}%"”
解决办法
查询后得知的mybatis注解正确的模糊查询语句为
select * from user where name like CONCAT(‘%’,#{name},‘%’);
完整示例:
@Select(“select * from user where name like CONCAT(‘%’,#{name},‘%’)”)List