代码自动生成mybatis-generator-maven-plugin的idea自动生成插件
<!--mybatis-generator插件-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>D:/GitFile/ka-product/ka-product-soa/src/main/resources/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
generatorConfig.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEgeneratorConfigurationPUBLIC"-//mybatis.org//DTDMyBatisGeneratorConfiguration1.0//EN""http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
<classPathEntrylocation="E:\repository\mysql\mysql-connector-java\5.1.30\mysql-connector-java-5.1.30.jar"/>
<contextid="DB2Tables"targetRuntime="MyBatis3">
<commentGenerator>
<propertyname="suppressDate"value="true"/>
<!--是否去除自动生成的注释true:是false:否-->
<propertyname="suppressAllComments"value="true"/>
</commentGenerator>
<!--数据库链接URL,用户名、密码-->
<jdbcConnectiondriverClass="com.mysql.jdbc.Driver"connectionURL="jdbc:mysql://192.168.147.35:3306/ka_product"userId="root"password="123456"/>
<javaTypeResolver>
<propertyname="forceBigDecimals"value="false"/>
</javaTypeResolver>
<!--生成模型的包名和位置-->
<javaModelGeneratortargetPackage="site.muhu.cmp.ucenter.model"targetProject="src/main/java">
<propertyname="enableSubPackages"value="true"/>
<propertyname="trimStrings"value="true"/>
</javaModelGenerator>
<!--生成映射文件的包名和位置-->
<sqlMapGeneratortargetPackage="mapping"targetProject="src/main/resources">
<propertyname="enableSubPackages"value="true"/>
</sqlMapGenerator>
<!--生成DAO的包名和位置-->
<javaClientGeneratortype="XMLMAPPER"targetPackage="site.muhu.cmp.ucenter.mapper"targetProject="src/main/java">
<propertyname="enableSubPackages"value="true"/>
</javaClientGenerator>
<!--要生成的表tableName是数据库中的表名或视图名domainObjectName是实体类名-->
<tabletableName="b2b_sku_base"domainObjectName="B2bSkuBase"enableCountByExample="false"enableUpdateByExample="false"enableDeleteByExample="false"enableSelectByExample="false"selectByExampleQueryId="false">
<generatedKeycolumn="id"sqlStatement="MySql"identity="true"/>
</table>
</context>
</generatorConfiguration>