今天调试一个非常简单的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会把'1'解析为字符,java是强类型语言,所以不能这样写,需要双引号

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2021-08-21
  • 2021-06-24
  • 2022-12-23
  • 2021-11-03
猜你喜欢
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-03-06
  • 2022-12-23
相关资源
相似解决方案