-- 1、匹配一个字段 比如user_name select * from tb_user where user_name like '%'+ #{keyWord} +'%'; select * from tb_user where user_name like concat('%',#{keyWord},'%');
-- 2、匹配多个字段 根据user_name或user_code查询 select * from tb_user where (user_name like concat('%',#{keyWord},'%')) or (user_code like concat('%',#{keyWord},'%')); select * from tb_user where concat(user_name, user_code) like concat('%',#{keyWord},'%');
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279815.html