1:查询名字叫张三的记录是多少条
select count(*) from user where username like '%${张三}%'
2:动态sql
select * from user
<where>
<if test="userCustom!=null and userCustom!=''">
<if test="userCustom.sex!=null and userCustom.sex!='' ">
and user.sex=#{userCustom.sex}
</if>
<if test="userCustom.username!=null and userCustom.username!='' ">
and user.username=#{userCustom.username}
</if>
</if>
</where>