Java根据数据表生成xml_第二篇 Springboot mybatis generate根据数据库表自动生成实体类、Mapper和Mapper.xml...

目录结构如下:只需增加一个generatorConfig.xml文件和在pom.xml中配置下Mybatis generator代码生成插件即可

4179aacdd2e63c511e1014ece1f20323.png

pom.xml中增加如下配置:

de4c979ac7c9a1d5c68be0d8ffa4fa0d.png

pom.xml中相关依赖及build插件部分代码

org.springframework.boot

spring-boot-starter-web

org.mybatis.spring.boot

mybatis-spring-boot-starter

2.1.1

mysql

mysql-connector-java

runtime

org.springframework.boot

spring-boot-starter-thymeleaf

2.1.4.RELEASE

org.springframework.boot

spring-boot-starter-jdbc

org.springframework.boot

spring-boot-starter-test

test

org.junit.vintage

junit-vintage-engine

src/main/resources

**/*.*

true

src/main/java

**/*.properties

**/*.xml

false

org.springframework.boot

spring-boot-maven-plugin

org.mybatis.generator

mybatis-generator-maven-plugin

1.3.1

${basedir}/src/main/resources/generatorConfig.xml

true

true

generatorConfig.xml文件内容如下:

userId="root" password="123456">

enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false">

enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false">

enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false">

enableSelectByExample="false" enableUpdateByExample="false" enableDeleteByExample="false">

0ac989faa1cb8562349dce889192d802.png

双击之后控制台会输出

6cf1a8691d09328a39ecff82fde1d835.png

完成

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值