當MyBatis 判斷條件爲等於的時候,常量需要加 .toString() 來轉換,這種方法是穩定的,推薦使用,比如
<!-- 正確的,穩定,推薦使用 -->
<if test="equipmentCd != null and equipmentCd != 'ALL'.toString()">
AND EQUIPMENT_CD = #{equipmentCd}
</if>
當MyBatis 判斷條件爲等於的時候,常量需要加 .toString() 來轉換,這種方法是穩定的,推薦使用,比如
<!-- 正確的,穩定,推薦使用 -->
<if test="equipmentCd != null and equipmentCd != 'ALL'.toString()">
AND EQUIPMENT_CD = #{equipmentCd}
</if>