<!-- dependency和plugin中jar的版本根据自己需求选择,但同一个jar版本要保持一致 -->
<!-- 配置在dependencies中 -->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.7</version>
</dependency>
<!-- 在build中,注意,不要写在pluginManagement中,另起一段,单独写plugins -->
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<dependencies>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.16.0.0</version>
</dependency>
</dependencies>
<configuration>
<overwrite>true</overwrite>
<!--<configurationFile>./generatorConfig.xml</configurationFile>-->
</configuration>
</plugin>
</plugins>
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>
<!--
<!-- mysql-connector-java 版本需要与pom中引得版本一致 -->
<classPathEntry location="C:\enviorment\repository\com\oracle\database\jdbc\ojdbc8\19.16.0.0\ojdbc8-19.16.0.0.jar" />
<context id="oracle2Tables" targetRuntime="MyBatis3">
<!-- 不加注释,因为默认注释是英文的 -->
<commentGenerator>
<property name="addRemarkComments" value="true"/>
<property name="suppressDate" value="true"/>
</commentGenerator>
<!-- 数据库连接信息 -->
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@es111:1521:orcl"
userId="fsxt_1"
password="123456">
</jdbcConnection>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetPackage 文件生成在指定包下,targetProject 路径-->
<javaModelGenerator targetPackage="com.cz.mhm.entity" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.cz.mhm.dao" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 数据库表以及对应的java模型类名(如果是多个表的话,可以复制多份然后修改成对应的表以及需要生成的模型名) -->
<!-- 入模指标-申请额-季度和月度 -->
<!--
<table tableName="DM_RMZB_SQ_JIDU" domainObjectName="ShenqingJidu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
<table tableName="DM_RMZB_SQ_YUEDU" domainObjectName="ShenqingYuedu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
-->
<!-- 入模指标 归集额-季度和月度 -->
<!--
<table tableName="DM_RMZB_GJ_JIDU" domainObjectName="GuijiJidu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
<table tableName="DM_RMZB_GJ_YueDU" domainObjectName="GuijiYuedu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
-->
<!-- 入模指标 回收额-季度和月度 -->
<!--
<table tableName="DM_RMZB_HS_JIDU" domainObjectName="HuishouJidu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
<table tableName="DM_RMZB_HS_YUEDU" domainObjectName="HuishouYuedu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
-->
<!-- 入模指标 提取额-季度和月度 -->
<table tableName="DM_RMZB_TQ_JIDU" domainObjectName="TiquJidu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
<table tableName="DM_RMZB_TQ_YUEDU" domainObjectName="TiquYuedu"
enableCountByExample="false" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true">
</table>
</context>
</generatorConfiguration>
执行
标签:enableUpdateByExample,enableSelectByExample,代码,maven,mybatis,enableCountByExampl From: https://blog.51cto.com/u_21817/6066943