**Maven中的依赖:
<mybatis.generator.version>1.3.6</mybatis.generator.version>
<!-- Java接口和实体类 -->
<targetJavaProject>${basedir}/src/main/java</targetJavaProject>
<targetMapperPackage>com.rootcloud.bfcec.mapper</targetMapperPackage>
<targetModelPackage>com.rootcloud.bfcec.entity</targetModelPackage>
<!-- XML生成路径 -->
<targetResourcesProject>${basedir}/src/main/resources</targetResourcesProject>
<targetXMLPackage>mapper</targetXMLPackage>**
<?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">
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="com.rootcloud.common.mybatis.GLOBALMapper"/>
</plugin>
<commentGenerator>
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/ks_excavator_test?useUnicode=true&characterEncoding=UTF8"
userId="root"
password="123">
</jdbcConnection>
<javaTypeResolver>
<property name="forceLongs" value="false"/>
</javaTypeResolver>
<javaModelGenerator targetPackage="${targetModelPackage}" targetProject="${targetJavaProject}">
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<sqlMapGenerator targetPackage="${targetXMLPackage}" targetProject="${targetResourcesProject}"/>
<javaClientGenerator targetPackage="${targetMapperPackage}" targetProject="${targetJavaProject}"
type="XMLMAPPER"/>
<table tableName="t_stat" domainObjectName="Stat" enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"/>
</context>
项目根目录下运行该命令:
mvn mybatis-generator:generate