<select id="queryVendorPageList" resultMap="VendorResultMap">
select a.login_name,v.*
from user_vendor v
LEFT JOIN sys_user_account a ON a.uid=v.uid
where 1=1
<if test="vendor.vendorType != null">
and v.vendor_type=#{vendor.vendorType}
</if>
<if test="vendor.loginName != null and vendor.loginName != ''">
and a.login_name=#{vendor.loginName}
</if>
<if test="vendor.name != null and vendor.name != ''">
and v.name like concat('%',#{vendor.name},'%')
</if>
<if test="vendor.tel != null and vendor.tel != ''">
and v.tel like concat('%',#{vendor.tel},'%')
</if>
<if test="vendor.contact != null and vendor.contact != ''">
and v.contact like concat('%',#{vendor.contact},'%')
</if>
<if test="vendor.status != null and vendor.status != ''">
and v.status=#{vendor.status}
</if>
order by v.addTime desc
</select>
在上述例子中,当vendor中的status的值为0时,<if test="vendor.status != null and vendor.status != ''">为false
去掉后面的vendor.status != ''为true