<?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>
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<jdbcConnection
driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/xiaomi?useUnicode=true&serverTimezone=GMT&useSSL=false"
userId="root"
password="root">
</jdbcConnection>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<javaModelGenerator targetPackage="code.domain" targetProject=".\src\main\java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="mapper" targetProject=".\src\main\resources\code">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="code.mapper" targetProject=".\src\main\java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table tableName="consumer" domainObjectName="Consumer"></table>
<table tableName="goods" domainObjectName="Goods"></table>
<table tableName="goods_images" domainObjectName="GoodsImages"></table>
<table tableName="goods_type" domainObjectName="GoodsType"></table>
<table tableName="goods_services" domainObjectName="GoodsServices"></table>
<table tableName="goods_package" domainObjectName="GoodsPackage"></table>
<table tableName="goods_configure" domainObjectName="GoodsConfigure"></table>
<table tableName="goods_cart" domainObjectName="GoodsCart"></table>
<table tableName="goods_order" domainObjectName="GoodsOrder"></table>
<table tableName="goods_order_itm" domainObjectName="GoodsOrderItm"></table>
<table tableName="goods_shipping_address" domainObjectName="GoodsShippingAddress"></table>
</context>
</generatorConfiguration>
package code;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class CodeGenerator {
public static void main(String[] args) throws Exception {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
File configFile = new File("generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
callback, warnings);
myBatisGenerator.generate(null);
}
}