MyBatis逆向工程去除表名前缀

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">


    <!--  enableInsert="false"  enableUpdateByPrimaryKey="false" enableUpdateByExample="false"
            enableDeleteByPrimaryKey="false" enableDeleteByExample="false"  -->

            <!--enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false" -->

            <!-- 指定对象名 domainObjectName="DeviceResponse" -->
            <!-- 属性非驼峰
            <property name="useActualColumnNames" value="true"/>
            -->

    <generatedKey column="id" sqlStatement="Mysql" identity="true"/>

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

这个意思就是匹配,开头的任意个非下划线(_)的字符,也就是这种如:c_,abc_。。。等等 
    <columnRenamingRule searchString="^[^_]+" replaceString=""/>
    <domainObjectRenamingRule searchString="^T" replaceString="" />

             <!-- 属性去前缀
            <columnRenamingRule searchString="^c_" replaceString="" />
            -->
            <!-- 指定字段类型
            <columnOverride column="content" javaType="java.lang.String" jdbcType="VARCHAR" />
            -->


</table>

https://blog.csdn.net/weixin_33743880/article/details/90121373

posted @ 2019-09-24 12:03  antball  阅读(3148)  评论(0编辑  收藏  举报