IDEA结合mybatis插件⾃动⽣成代码idea配置artifacts
pom⽂件添加插件
<plugin>
<groupId&ator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<!--配置⽂件的位置-->
<configurationFile>${basedir}/src/main/resources/l</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<phase>deploy</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
如何打开url文件</executions>
<dependencies>
<dependency>
<groupId&batis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>
oracle含金量高的证书
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
<dependency>
xml常用标签
<groupId&ator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>绩效考核中sqrt函数
</plugin>
配置⽂件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-////DTD MyBatis Generator Configuration 1.0//EN"
"/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>displaynone和block
<context id="testTables" targetRuntime="MyBatis3">
<plugin type="ator.plugins.UnmergeableXmlMappersPlugin"></plugin>
<commentGenerator>
<!-- 是否去除⾃动⽣成的注释 true:是: false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、⽤户名、密码 -->
<jdbcConnection driverClass="sql.jdbc.Driver"
connectionURL="jdbc:mysql://1:3306/cloud-greycrane" userId="root"
password="Ko">
</jdbcConnection>
<!-- <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:orcl"
userId="scott"
password="wcy675600920">
</jdbcConnection> -->
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- targetProject:⽣成PO类的位置 -->
<javaModelGenerator targetPackage="ity"
targetProject=".\src\main\java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- targetProject:mapper映射⽂件⽣成的位置 -->
<sqlMapGenerator targetPackage="mapping"
targetProject=".\src\main\resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- targetPackage:mapper接⼝⽣成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.mapper"
targetProject=".\src\main\java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!-- schema即为数据库名 tableName为对应的数据库表名 domainObjectName是要⽣成的实体类名称 enable*ByExample,是否⽣成 example⽅法,根据⾃⼰的来,多个可以往下添加--> <table tableName="test" domainObjectName="Test" schema="" enableCountByExample="false"
enableDeleteByExample="false" enableUpdateByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
使⽤

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。