码迷,mamicode.com
首页 > 其他好文 > 详细

mybatis中用tinyint保存Boolean类型

时间:2018-03-19 20:57:30      阅读:783      评论:0      收藏:0      [点我收藏+]

标签:post   blog   去掉   tin   使用   gpo   div   空字符串   span   

mybatis中用tinyint保存Boolean类型的时候,直接使用false和true就可以,mybatis会自动映射。

但是要注意的是,一般的mapper.xml中写where的时候会判断

<if test="comment !=null and comment !=‘‘">  
    comment=#{comment},  
</if>  

但是这里要判断的时候就要去掉后边的不等于空字符串了,应该使用如下的判断

<if test="comment !=null">  
    comment=#{comment},  
</if>  

 

mybatis中用tinyint保存Boolean类型

标签:post   blog   去掉   tin   使用   gpo   div   空字符串   span   

原文地址:https://www.cnblogs.com/yt975548/p/8604227.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!