Mybatis generator的使用主要是 generatorConfig.xml配置文件的使用

Generatorconfig.xml代码
" wmode="transparent"> 收藏代码
<?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> 
    <properties resource="util/generatorConfig.properties" /> 
    <!-- classPathEntry:数据库的JDBC驱动,换成你自己的驱动位置 --> 
     
    <classPathEntry location="${classPath}" /> 
    <context id="MBG" targetRuntime="MyBatis3" 
        defaultModelType="conditional"> 
        <plugin type="plugin.SelectByPagePlugin" /> 
        <!-- 此处是将Example改名为Criteria 当然 想改成什么都行~ 
            <plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin"> 
            <property name="searchString" value="Example$" /> 
            <property name="replaceString" value="Criteria" /> 
            </plugin> 
        --> 
        <plugin 
            type="org.mybatis.generator.plugins.EqualsHashCodePlugin" /> 
        <plugin 
            type="org.mybatis.generator.plugins.MapperConfigPlugin"> 
            <property name="fileName" value="GeneratedMapperConfig.xml" /> 
            <property name="targetPackage" 
                value="com.cy.mybatis.mbg.util" /> 
            <property name="targetProject" value="${targetProject}" /> 
        </plugin> 
        <commentGenerator> 
         <!-- 去除自动生成的注释 --> 
            <property name="suppressAllComments" value="true" /> 
        </commentGenerator> 
        <jdbcConnection driverClass="${driverClass}" 
            connectionURL="${connectionURL}" userId="${userId}" 
            password="${password}"> 
        </jdbcConnection> 
        <javaTypeResolver> 
            <property name="forceBigDecimals" value="false" /> 
        </javaTypeResolver> 
        <!-- targetProject:自动生成代码的位置 --> 
        <javaModelGenerator targetPackage="${modelPackage}" 
            targetProject="${targetProject}"> 
            <property name="enableSubPackages" value="true" /> 
        </javaModelGenerator> 
 
        <sqlMapGenerator targetPackage="${sqlMapperPackage}" 
            targetProject="${targetProject}"> 
            <property name="enableSubPackages" value="true" /> 
        </sqlMapGenerator> 
 
        <javaClientGenerator type="XMLMAPPER" 
            targetPackage="${daoMapperPackage}" 
            targetProject="${targetProject}"> 
            <property name="enableSubPackages" value="true" /> 
        </javaClientGenerator> 
        <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 --> 
        <!--  
            <table tableName="visitor_info" domainObjectName="Visitor" enableCountByExample="false" enableUpdateByExample="false" 
            enableDeleteByExample="false" enableSelectByExample="false" 
            selectByExampleQueryId="false"> 
             
            </table> 
        --> 
        <table tableName="weather_info" domainObjectName="Weather"> 
        </table> 
    </context> 
</generatorConfiguration> 

你可能感兴趣的:(Mybatis generator的使用主要是 generatorConfig.xml配置文件的使用)