一、in的使用
写在where条件之后
where state in (#{state},#{state2})
二 or的使用
(1) 一个字段对应两个参数值的
<if test="cardcode != null and cardcode != ''">
and v.cardcode=(#{cardcode} OR #{originalcontractid})
</if>
(2)两个字段对应一个参数值的
<if test="cardcode != null and cardcode != ''">
and (v.cardcode=#{cardcode}
OR v.originalcontractid=#{cardcode}
)
</if>
三、like 的使用
(1) 第一种
<if test="applyName != null and applyName != ''" >
<![CDATA[ AND v.apply_name LIKE concat(concat('%', #{applyName, jdbcType=VARCHAR}), '%')]]>
</if>
(1) 第二种
<if test="userName != null and userName != ''">AND e.name like CONCAT('%',#{userName},'%')
</if>