xml 文件中mybatis 的sql写法
like
方式一:
<if test="params.itemName != null and params.itemName != ''">
and item_name like CONCAT('%',#{params.itemName},'%')
</if>
方式二:
<if test="params.itemName != null and params.itemName != ''">
and item_name like '%' || #{params.itemName} || '%'
</if>
CDATA
<if test="createTimeStart != null">
and create_time <![CDATA[ >= ]]> #{createTimeStart}
</if>
<if test="createTimeEnd != null">
and create_time <![CDATA[ < ]]> #{createTimeEnd}
</if>
纸上得来终觉浅,绝知此事要躬行。