- 多条件查询
select * from User
<where>
<if "name != null and name != '' ">
and name like #{name}
<if>
<if "age != null and age != '' ">
and age = #{age}
<if>
</where>
- 选择单条件查询
select * from User
<where>
<if "name != null and name != '' ">
and name like #{name}
<if>
<if "age != null and age != '' ">
and age = #{age}
<if>
</where>