MybatasPlus代码生成器

新建一个测试类

package com.example;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Collections;

@SpringBootTest
public class MybatisPlusTest {
public static void main(String[] args) {
/** 数据连接 记得改成你的数据库,用户名和密码 */
FastAutoGenerator.create(“jdbc:mysql://localhost:3306/数据库名称?serverTimezone=GMT%2B8”, “root”, “”)
.globalConfig(builder -> {
builder.author(“hsy”) // 设置作者
//.enableSwagger() // 开启 swagger 模式
// .fileOverride() // 释放执行就会覆盖已生成文件
//鼠标右击蓝色java目录,选择Copy Path… 选择 Absolute Path 即可复制路径,粘贴到下面即可
.outputDir(“输出目录”); // 指定输出目录
})
.packageConfig(builder -> {
builder.parent(“com.mapper”) // 设置父包名
// .moduleName(“”) // 设置父包模块名 需要你就设置
.pathInfo(Collections.singletonMap(OutputFile.mapperXml, “路径”)); // 设置mapperXml生成路径
})
.strategyConfig(builder -> {
//
builder.addInclude(“sys_device”)// 设置需要生成的表名
// builder.addTablePrefix(“t_”, “c_”). // 设置过滤表前缀 卡尼的表是否存在前缀
;
})
.templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
.execute();
}
}

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值