本人微信公众号"aeolian"~

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  >= ]]> #{money_search_start}
      if>
      <if test='money_search_end != null and money_search_end != "" and money_search_end != "0" '>
        and acc.money  <= ]]> #{money_search_end}
      if>

 

点赞

Leave a Reply

Your email address will not be published. Required fields are marked *