Mybatis 模糊查询
1、oracle
方式一:
select name from staff <where> <if test="name != null"> name like '%'|| #{name} ||'%' </if> </where>
方式二:
select name from staff <where> <if test="name != null"> name like concat(concat('%',#{name}),'%') </if> </where>
2、mysql
select name from staff <where> <if test="name!= null"> and namelike concat('%',#{name},'%') </if> </where>