xml中的<where><if>模糊查询


select * from a
<where>
<!-- 模糊查询 -->
<if test="name !=null || name !=''">
and name like '%'||#{name}||'%' //name like '%${name}%'
</if>
<if test="age !=null || age!=''">
and name = #{age}
</if>
<if test="sex !=null and sex!=''">
and sex = #{sex}
</if>
</where>
原文地址:https://www.cnblogs.com/lidar/p/12957980.html