步骤一:
1、在工程中pom.xml加添
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
2、在工程resources目录下添加generatorConfig.xml文件
命令:mybatis-generator:generate -e
[img]http://dl2.iteye.com/upload/attachment/0121/2857/ae90562f-5c5e-339d-9f1c-63891bb6a071.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0121/2861/a53d329f-8d8e-37f1-8707-e3d3564db700.png[/img]
1、在工程中pom.xml加添
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
2、在工程resources目录下添加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="mysql-connector-java-5.0.6-bin.jar"/>-->
<classPathEntry location="D:\MvnRepository\mysql\mysql-connector-java\5.1.6\mysql-connector-java-5.1.6.jar"/>
<context id="default" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.1.11:3306/passport" userId="jshy" password="23DlwsxcdeJ32">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.ppfuns.model" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.ppfuns.dao" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成哪些表-->
<!--<table tableName="collect_lesson" domainObjectName="CollectLesson" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!--<table tableName="lesson_classes" domainObjectName="LessonClasses" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!--<table tableName="pre_play_record" domainObjectName="PrePlayRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
</context>
</generatorConfiguration>
命令:mybatis-generator:generate -e
[img]http://dl2.iteye.com/upload/attachment/0121/2857/ae90562f-5c5e-339d-9f1c-63891bb6a071.png[/img]
-Dmaven.multiModuleProjectDirectory=$M2_HOME
[img]http://dl2.iteye.com/upload/attachment/0121/2861/a53d329f-8d8e-37f1-8707-e3d3564db700.png[/img]