美文网首页
mybatis-generator-config.xml

mybatis-generator-config.xml

作者: changhr2013 | 来源:发表于2018-07-25 14:13 被阅读0次
    <?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:数据库的JDBC驱动的jar包地址 -->
        <classPathEntry
                location="D:\software\maven\repo\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar" />
        <context id="MysqlTables" targetRuntime="MyBatis3">
    
            <commentGenerator>
                <!-- 是否去除自动生成的注释 true:是 false:否 -->
                <property name="suppressAllComments" value="true" />
            </commentGenerator>
    
            <!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
            <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
                            connectionURL="jdbc:oracle:thin:@xx.xx.x.xxx:1521:xx"
                            userId="xx"
                            password="1">
            </jdbcConnection>
    
            <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,
                     true,把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal -->
            <javaTypeResolver>
                <property name="forceBigDecimals" value="false" />
            </javaTypeResolver>
    
            <!-- 生成实体类地址 -->
            <!-- targetProject:自动生成代码的位置 -->
            <javaModelGenerator targetPackage="com.rabbitmq.topic.entity"
                                targetProject="src/main/java">
                <!-- enableSubPackages:是否让schema作为包的后缀 -->
                <property name="enableSubPackages" value="false" />
                <!-- 是否针对string类型的字段在set的时候进行trim调用 -->
                <property name="trimStrings" value="true" />
            </javaModelGenerator>
    
            <!-- 生成XxxMapper.xml文件 -->
            <sqlMapGenerator targetPackage="mapper"
                             targetProject="src/main.resources">
                <property name="enableSubPackages" value="false" />
            </sqlMapGenerator>
    
            <!-- 生成接口 XxxMapper.java -->
            <javaClientGenerator type="XMLMAPPER"
                                 targetPackage="com.rabbitmq.topic.mapper"
                                 targetProject="src/main/java">
                <property name="enableSubPackages" value="false" />
            </javaClientGenerator>
    
            <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
            <table tableName="tbl_user" domainObjectName="User"
                   enableCountByExample="true" enableUpdateByExample="true"
                   enableDeleteByExample="true" enableSelectByExample="true"
                   selectByExampleQueryId="true" >
            </table>
        </context>
    
    </generatorConfiguration>
    

    相关文章

      网友评论

          本文标题:mybatis-generator-config.xml

          本文链接:https://www.haomeiwen.com/subject/julpmftx.html