首页 > 其他 > 详细

mybatis if test 判断字符串的坑

时间:2018-12-14 14:30:26      阅读:196      评论:0      收藏:0      [点我收藏+]

今天调试一个非常简单的test判断字符串查询语句,怎么调试都是不好用,后来百度才发现,是我写的test标签写错了,我写成:

 <if test="record.current != null and record.current==‘1‘" >    注意:1旁边是单引号

 

正确写法:

 <if test="record.current != null and record.current==‘1‘.toString()" >

 

或者:

<if test = ‘record.current != null and record.current==“1”‘> 注意:1 旁边是双引号

 

因为mybatis会把‘1‘解析为字符,java是强类型语言,所以不能这样写,需要双引号

mybatis if test 判断字符串的坑

原文:https://www.cnblogs.com/DylanZ/p/10119146.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!