Eclipse plugin - MyBatis automatically generates code

Download the following attachment: MyBatis_Generator_1.3.1.zip.zip

Copy these two folders directly to the eclipse directory



 restart eclipse

 Add the following xml file under the project

<?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:\Program Files\apache-maven-3.3.3\mvnRepository\mysql\mysql-connector-java\5.1.38\mysql-connector-java-5.1.38.jar" />
	<context id="mysqlTables" targetRuntime="MyBatis3">
		 <plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
		<commentGenerator>
			<property name="suppressAllComments" value="true" />
		</commentGenerator>
		<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/zwp-user" userId="root" password="root" />
		<javaTypeResolver>
			<property name="forceBigDecimals" value="false" />
		</javaTypeResolver>
		<javaModelGenerator targetPackage="com.zhouwangpu.web.model.user" targetProject="zwp-web">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>
		<sqlMapGenerator targetPackage="orm.user" targetProject="zwp-web/src/main/resources">
			<property name="enableSubPackages" value="false" />
		</sqlMapGenerator>
		<javaClientGenerator targetPackage="com.zhouwangpu.web.mapper.user" targetProject="zwp-web" type="XMLMAPPER">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>
		<table tableName="user_info" domainObjectName="UserInfo" enableSelectByExample="false" enableUpdateByPrimaryKey="false"
		enableCountByExample="false" enableDeleteByExample="false" enableUpdateByExample="false" enableDeleteByPrimaryKey="false"></table>
	</context>
</generatorConfiguration>  

 

 Right-click on the file and perform the following operations:



 

The following code is automatically generated

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326679532&siteId=291194637