Mybatis中 test 字符串比较问题

mybatis中我们常用 test 来进行判空或字符串比较,总会遇到一些坑。

 

错误写法:<if test="status == 'Z'">

  结果:抛异常NumberFormatException异常!

 

正确写法:

  写法一:<if test="status == 'Z'.toString()">

  写法二:<if test='status == "Z"'>

 

posted @ 2018-01-17 10:26  ✿Trepverter╮  阅读(674)  评论(0)    收藏  举报