idea一键生成mapper.xml
时间: 2023-07-05 16:20:11 浏览: 254
您可以使用MyBatis Generator插件来一键生成Mapper.xml文件。以下是使用步骤:
1.在pom.xml文件中添加MyBatis Generator插件依赖。
```
<dependencies>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.7</version>
</dependency>
</dependencies>
```
2.在pom.xml文件中添加MyBatis Generator插件配置。
```
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
```
3.在MyBatis Generator配置文件中指定要生成Mapper.xml文件的表。
```
<table tableName="table_name" domainObjectName="Entity"></table>
```
4.在命令行中执行以下命令来生成Mapper.xml文件。
```
mvn mybatis-generator:generate
```
以上是使用MyBatis Generator插件一键生成Mapper.xml文件的步骤。
阅读全文
相关推荐

















