generatorConfig.xml 代码生成器

generatorConfig.xml 代码生成器

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
  <!--   <classPathEntry  location="C:\Users\xxx\.m2\repository\org\mybatis\mybatis\3.4.2\mybatis-3.4.2.jar"/> -->
    <context id="DB2Tables"  targetRuntime="MyBatis3" defaultModelType="flat">
        <commentGenerator>
            <property name="suppressDate" value="false"/>
            <!-- 是否去除自动生成的注释 true:是 : false:否 -->
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>
        <!--数据库链接URL,用户名、密码
           1.一般jdbc数据库的版本6.x以上,都是com.mysql.cj.jdbc.Driver  其他的低版本就是com.mysql.cj.jdbc.Driver
         -->
       <!--  这里不需要指定哪个数据库 在下面table标签里指定 -->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver" 
        connectionURL="jdbc:mysql://172.16.253.52:13306?useUnicode=true&amp;characterEncoding=UTF-8" userId="root" password="root">
        </jdbcConnection>
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>
        <!-- 生成模型的包名和位置-->
        <javaModelGenerator targetPackage="com.nsitd.sncp.db.bean" targetProject="nsitd-imps/src/main/java">
            <property name="enableSubPackages" value="false"/><!-- 不添加后缀 -->
            <property name="trimStrings" value="false"/>
        </javaModelGenerator>
        <!-- 生成映射文件的包名和位置-->
        <sqlMapGenerator targetPackage="com.nsitd.sncp.db.mapper" targetProject="nsitd-imps/src/main/resources">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>
        <!-- 生成DAO的包名和位置-->
<!--            1,ANNOTATEDMAPPER:会生成使用Mapper接口+Annotation的方式创建(SQL生成在annotation中),不会生成对应的XML;
	            2,MIXEDMAPPER:使用混合配置,会生成Mapper接口,并适当添加合适的Annotation,但是XML会生成在XML中;
	            3,XMLMAPPER:会生成Mapper接口,接口完全依赖XML -->
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.nsitd.sncp.db.mapper" targetProject="nsitd-imps/src/main/java">
            <property name="enableSubPackages" value="false"/>
        </javaClientGenerator>
        <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名 catalog数据库名称 添加此属性解决了生成重复代码问题-->
        <table catalog="SNCP_IMPS" tableName="TMN_TERMINAL" domainObjectName="TmnTerminal" 
        enableCountByExample="false" enableUpdateByExample="false" 
        enableDeleteByExample="false" enableSelectByExample="false" 
        selectByExampleQueryId="false">
        	<generatedKey column="ID" sqlStatement="Mysql"></generatedKey>
        </table>
        <table catalog="SNCP_IMPS" tableName="AUTH_ACTIVATION" domainObjectName="AuthActivation" 
        enableCountByExample="false" enableUpdateByExample="false" 
        enableDeleteByExample="false" enableSelectByExample="false" 
        selectByExampleQueryId="false">
        	<generatedKey column="ID" sqlStatement="Mysql"></generatedKey>
        </table>
         <table catalog="SNCP_IMPS" tableName="TMN_HIS_TERMINAL" domainObjectName="TmnHisTerminal" 
        enableCountByExample="false" enableUpdateByExample="false" 
        enableDeleteByExample="false" enableSelectByExample="false" 
        selectByExampleQueryId="false">
        	<generatedKey column="ID" sqlStatement="Mysql"></generatedKey>
        </table>
    </context>
</generatorConfiguration>

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HiJohnnyBoy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值