MyBatis逆向工程去除表名前缀

青春壹個敷衍的年華 提交于 2019-11-30 09:52:47

https://www.jianshu.com/p/e09d2370b796

https://blog.csdn.net/baidu_16757561/article/details/75071476

https://blog.csdn.net/littleboyandgirl/article/details/82285986

https://blog.csdn.net/isea533/article/details/42102297

https://www.jianshu.com/p/e09d2370b796
mybatis-config.xml详解
https://blog.csdn.net/wsh596823919/article/details/80761911

Git Flow Integration
Free Mybatis plugin
MyBatis Log Plugin
MyBatis Xml Validator
Power Mode
mybatipse
Eclipser converts Eclipse launch configurations into IntelliJ IDEA configurations:
GsonFormat
Lombok plugin
https://www.jianshu.com/p/b44dad6266a3
https://gitee.com/nieqiurong/mybatis-log

场景:
比如表名为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>


<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>


<table schema="" tableName="t_goods%" enableCountByExample="false"
       enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false">
    <generatedKey column="id" sqlStatement="Mysql" identity="true"/>

earchString="^[^_]+",这个查找字符串就是使用正则表达式来匹配表的字段名

这个意思就是匹配,开头的任意个非下划线(_)的字符,也就是这种如:c_,abc_。。。等等 
    <columnRenamingRule searchString="^[^_]+" replaceString=""/>
    <domainObjectRenamingRule searchString="^T" replaceString="" />
</table>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!