配置文件generatorConfig.xml

配置文件generatorConfig.xml

文件路径  


主要有三点:

1.新建配置文件。

2.指定jar包位置。

3.修改targetProject 路径


<?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="D:\mavenLib\mysql\mysql-connector-java\5.1.29\mysql-connector-java-5.1.29.jar" />     
    <!-- <classPathEntry location="C:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar" />-->    
    <context id="my" targetRuntime="MyBatis3">
    <!-- 生成的pojo,将implements Serializable-->    
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>    
<!--         <commentGenerator>     -->
<!--             是否去除自动生成的注释 true:是 : false:否     -->
<!--             <property name="suppressAllComments" value="false" />     -->
<!--         </commentGenerator>         -->
        <commentGenerator>    
            <property name="suppressAllComments" value="true" />    
        </commentGenerator>    
        <!-- 数据库链接URL、用户名、密码 -->    
         <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.1.32:3306/douniu_db?characterEncoding=utf8" userId="root" password="root1234">     
        </jdbcConnection>    
        <javaTypeResolver>    
            <property name="forceBigDecimals" value="false" />    
        </javaTypeResolver>    
        <!-- 生成模型的包名和位置 -->    
        <javaModelGenerator targetPackage="com.niuniu.game.plate.entity.test" targetProject="DouNiu/src/main/java">    
            <property name="enableSubPackages" value="true" />    
            <property name="trimStrings" value="true" />    
        </javaModelGenerator>    
        <!-- 生成的映射文件包名和位置 -->    
        <sqlMapGenerator targetPackage="com.niuniu.game.plate.mapper.test" targetProject="DouNiu/src/main/java">  
            <property name="enableSubPackages" value="true" />    
        </sqlMapGenerator>    
        <!-- 生成DAO的包名和位置 -->    
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.niuniu.game.plate.dao.test" targetProject="DouNiu/src/main/java">    
            <property name="enableSubPackages" value="true" />    
        </javaClientGenerator>    
        <!-- 要生成那些表(更改tableName和domainObjectName就可以) -->    
        <table tableName="tbl_plate_round_score" domainObjectName="PlateRoundScore" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />    
        <!-- <table tableName="course_info" domainObjectName="CourseInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />    
        <table tableName="course_user_info" domainObjectName="CourseUserInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" /> -->    
    </context>    
</generatorConfiguration>

猜你喜欢

转载自blog.csdn.net/bauterujj/article/details/71713628