mybatis的xml配置中if text判斷不為0


問題:
money_search_end != ‘0’
為0時依然繼續執行

解決方案:

1.單個字符要用''.toString()

2.用雙引號“”,當然text的引號要改為單引號‘’

      <if test="money_search_start != null and money_search_start != '' and money_search_start != '0'.toString()">
        and acc.money <![CDATA[ >= ]]> #{money_search_start}
      </if>
      <if test='money_search_end != null and money_search_end != "" and money_search_end != "0" '>
        and acc.money <![CDATA[ <= ]]> #{money_search_end}
      </if>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM