1、
2、 点击Add...
Name自定义
在Location中输入https://dl.bintray.com/mybatis/mybatis-generator/
3、勾选之后,点击next。一步一步点下去就可以了。
4、选中工程一个目录(新建生成文件的位置)。点击右键->New->Other...

5、
6、
7、生成的文件内容如下:

8、我的配置如下:
<generatorConfiguration>
<classPathEntry
location="D:/Program Files (x86)/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar" />
<context id="context1">
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/jeesite?useUnicode=true"
userId="root" password="123456" />
<javaModelGenerator targetPackage="com.thinkgem.jeesite.test.own.testgen.entity"
targetProject="jeesite\src\main\java" />
<sqlMapGenerator targetPackage="mappings.test"
targetProject="jeesite\src\main\resources" />
<javaClientGenerator targetPackage="com.thinkgem.jeesite.test.own.testgen.mapper"
targetProject="jeesite\src\main\java" type="XMLMAPPER" />
<table tableName="table_1"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>
</context>
</generatorConfiguration>
9、配置完之后,右键配置文件。选中Generate MyBatis/iBATIS Artifacts

10、在对应的文件目录即可生成相应的文件

本文介绍如何配置并使用MyBatis Generator来自动生成持久层代码。包括设置Maven依赖源、配置Generator文件以及生成Java实体类、Mapper接口及XML映射文件等步骤。
342

被折叠的 条评论
为什么被折叠?



