转载地址:http://blog.csdn.net/xiangtaoxiangtao/article/details/47454729
1 问题描述:
使用Mybatis查询tinyint(1)字段数据,返回值为Map类型,那么tinyint(1)的数据默认会转化为boolean类型数据.
解决方案:
1.使用ifnull(column, 0)处理该字段,个人测试过可以;
2.在jdbcUrl添加参数:tinyInt1isBit=false(默认为true)
3.避免使用长度为1的tinyint类型字段存储数字格式的数据;
2 问题描述
MyBatis逆向工程去除表名前缀
场景:
比如表名为t_user,想要生成User开头的文件,而不是TUser开头的文件。
需要下载1.3.6版本的mybatis-generator
https://github.com/mybatis/generator/releases
然后更改配置文件
<table schema="" tableName="t_user"><domainObjectRenamingRule searchString="^T" replaceString="" /></table>
相比以前,新增了
<domainObjectRenamingRule searchString="^T" replaceString="" />
一定要注意,T必须大写,否则是没用的。