-- 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},'%');