众所周知,SQL语句中的like模糊查询   select * from table where name like‘%张蛋%’,

但实际开发中经常用到 select * from table where name  like concat(#{name},'%')

比如根据用户名或手机号模糊查找用户

(us.nick_name LIKE CONCAT('%',#{keyWord},'%') OR us.phone LIKE CONCAT('%',#{keyWord},'%'))

 

Logo

更多推荐