mybatis generator使用_Mybatis Generator配置和使用

Mybatis Generator使用很简单:一共三步骤.

第一步:导入插件,在pom文件中导入插件

 <plugin>
        <groupId>org.mybatis.generator</groupId>
        <artifactId>mybatis-generator-maven-plugin</artifactId>
        <version>1.3.5</version>
        <dependencies>
          <dependency>
            <groupId> mysql</groupId>
            <artifactId> mysql-connector-java</artifactId>
            <version> 5.1.39</version>
          </dependency>
          <dependency>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-core</artifactId>
            <version>1.3.5</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>Generate MyBatis Artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!--允许移动生成的文件 -->
          <verbose>true</verbose>
          <!-- 是否覆盖 -->
          <overwrite>false</overwrite>
          <!-- 自动生成的配置 -->
          <configurationFile>
            src/main/resources/mybatis-generator.xml</configurationFile>
        </configuration>
      </plugin>

第二步:新增文件:mybatis-generator.xml在资源路径下

70749a7dd588df776c4c59e3ecbf8964.png

具体配置说明如下,来自

Mybatis Generator最完整配置详解​www.jianshu.com
<?

第三步:生成model,mapper和xml文件

点击生成即可生成代码到指定目录

c7d06667dcabc7ff036ca0fd31369402.png

是不是很简单,但是配置属性需要大家熟练记住!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值