欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MyBatis Generator 配置记录

程序员文章站 2022-07-12 13:53:36
...

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="/Users/mac/Documents/apache-maven-3.5/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar" />
	<context id="oracleContext" targetRuntime="MyBatis3"
		defaultModelType="flat">
		<property name="beginningDelimiter" value="`" />
		<property name="endingDelimiter" value="`" />



		<commentGenerator>
			<property name="suppressDate" value="true" />
		</commentGenerator>

		<jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"
			connectionURL="jdbc:sqlserver://localhost:1433;DatabaseName=osg_building_dev"
			userId="sj111a" password="111">
		</jdbcConnection>

		<javaTypeResolver>
			<property name="forceBigDecimals" value="false" />
		</javaTypeResolver>


		<javaModelGenerator targetPackage="com.ebroker.admin.common.orm.model"
			targetProject="src/main/java">
			<property name="enableSubPackages" value="false" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="com.ebroker.admin.common.orm.xml"
			targetProject="src/main/java">
			<property name="enableSubPackages" value="false" />
		</sqlMapGenerator>

		<javaClientGenerator type="XMLMAPPER"
			targetPackage="com.ebroker.admin.common.orm.mapper" targetProject="src/main/java">
			<property name="enableSubPackages" value="false" />
		</javaClientGenerator>


		<!--<table schema="dbo" tableName="%">-->
		<!--</table>-->


		<table schema="dbo" tableName="%">
			<generatedKey column="id" sqlStatement="JDBC" identity="true" />
		</table>

		<table tableName="region_location" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
			<generatedKey column="region_id" sqlStatement="JDBC" identity="true" />
		</table>

		<table tableName="stock_detail" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
			<generatedKey column="sto_id" sqlStatement="JDBC" identity="true" />
			<columnOverride column="Office_Sel_Remark" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Comments" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Comments_cn" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Office_Sel_Remark_cn" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
		</table>

		<table tableName="stastic_data" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
			<generatedKey column="std_id" sqlStatement="JDBC" identity="true" />
		</table>

		<table tableName="app_visit" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
			<generatedKey column="visit_type" sqlStatement="JDBC" identity="true" />
		</table>

		<table tableName="sysdiagrams" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
			<generatedKey column="diagram_id" sqlStatement="JDBC" identity="true" />
		</table>

		<table tableName="mobile_building" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
			<columnOverride column="Access_cn" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Tel_Prov_cn" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Access" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Amenities" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
			<columnOverride column="Tel_Prov" javaType="java.lang.String"
							jdbcType="LONGVARCHAR" />
		</table>

		<table tableName="region" enableCountByExample="false"
			   enableUpdateByExample="true" enableDeleteByExample="true"
			   enableSelectByExample="true" selectByExampleQueryId="false">
		</table>




	</context>
</generatorConfiguration>

pom

<plugin>
				<groupId>org.mybatis.generator</groupId>
				<artifactId>mybatis-generator-maven-plugin</artifactId>
				<version>1.3.2</version>
				<configuration>
					<configurationFile>${basedir}/src/main/resources/generatorConfig.xml</configurationFile>
					<verbose>true</verbose>
					<overwrite>true</overwrite>
				</configuration>
			</plugin>

 

相关标签: 配置