spring-boot mybatis代码生成(idea插件方式)

spring-boot mybatis代码生成。(注:此工具为idea插件方式,不支持自定义模板,如需要源码模板可自行修改)源码地址

示例生成的代码,包含生成后代码缩依赖的类示例生成项目

  1. 新建spring-boot项目,示例为gradle构建
    项目依赖

依赖片段如下:

compile 'org.springframework.boot:spring-boot-starter-web:2.0.4.RELEASE'
compile 'org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2'
compile 'com.alibaba:druid-spring-boot-starter:1.1.10'
compile 'mysql:mysql-connector-java:5.1.47'
compile 'com.spring4all:swagger-spring-boot-starter:1.7.1.RELEASE'
compile 'org.apache.commons:commons-lang3:3.8'
compile 'commons-collections:commons-collections:3.2.2'
  1. 新建项目配置( 注:暂时只支持.yml配置

  2. 安装生成插件

    • 方式一:idea-> file-> Settings-> Plugins-> Browser repositories… 搜索“mybatis code generator” 安装。
    • 方式二:下载(生成插件) idea-> file-> Settings-> Plugins-> Install plugin from disk… 安装。
  3. 生成代码

    • idea-> Code-> Code Generator 填写相关信息
      生成代码
      填写信息
  4. 手动更新项目目录

    • 如果项目没有自动更新,手动更新即可
      更新项目目录
  5. 最终效果

    • 生成代码如下
      最终效果
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
[INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 73, column 21 [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 85, column 21 [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 82, column 21 @ [ERROR] The build could not read 3 projects -> [Help 1] [ERROR] [ERROR] The project org.pw:user-service:1.0-SNAPSHOT (C:\workspace\tools\idea\myproject\mysb\user-service\pom.xml) has 1 error [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 73, column 21 [ERROR] [ERROR] The project org.pw:order-service:1.0-SNAPSHOT (C:\workspace\tools\idea\myproject\mysb\order-service\pom.xml) has 1 error [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 85, column 21 [ERROR] [ERROR] The project org.pw:login-service:1.0-SNAPSHOT (C:\workspace\tools\idea\myproject\mysb\login-service\pom.xml) has 1 error [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 82, column 21 [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:.
06-01

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值