首页 > 其他 > 详细

MyBatis逆向工程去除表名前缀

时间:2019-09-24 12:57:15      阅读:75      评论:0      收藏:0      [点我收藏+]

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>

MyBatis逆向工程去除表名前缀

原文:https://www.cnblogs.com/antball/p/11577598.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!