mybatis逆向生成实体类xml模板等

 1 新建springboot项目(准备工作)

准备工作,适合没有项目但是想练手的小伙伴,如果有项目直接使用可以直接跳到下一部分

要是没有resources目录请查阅【报错】新建springboot项目时缺少resource-优快云博客我的这篇文章讲解了缺少resources的解决方案

2 mybatis逆向工程生成entity和mapper

2.1在pom.xml加入如下依赖

2.2  application

这边主要就把下面的内容全部复制到application之间,注意改一下端口号和数据库名字,其他就可以了

server:
  port: 8080
spring:
  main:
    allow-circular-references: true
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/wx_shop?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8
    username: root
    password: 123456
    hikari:
      max-lifetime: 1000000
  thymeleaf:
    cache: false #关闭缓存
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB

mybatis:
  mapper-locations: classpath:mapper/*.xml
  type-aliases-package: com.example.entity

pagehelper:
  helper-dialect: mysql
  reasonable: true
  support-methods-arguments: true
  params: count=countSql

authority:
  info: '[]'

logging:
  file:
    path: log
    name: log/my.log
  level:
    com:
      example:
        dao: debug

2.3 generator文档如下

位置如下

具体xml内容如下

<?xml version="1.0" encoding="UTF-8&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值