BUG

作者: ieleven | 来源:发表于2018-03-27 20:02 被阅读0次

Mybatis

1.今天在使用mybatis时遇到一个问题,java代码中传递的整数0在mybatis中被识别成null

<where>  
  <if test="status != null and status !=''">  
      and status=#{status,jdbcType=INTEGER}  
  </if>  
</where>

如果java代码需要往mybatis传递整数0,那么需要判断,具体如下所示:

<where>  
  <if test="status != null and status !='' or status==0">  
      and status=#{status,jdbcType=INTEGER}  
  </if>  
</where>

相关文章

网友评论

      本文标题:BUG

      本文链接:https://www.haomeiwen.com/subject/omoscftx.html