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