package com.springboot.springbootjsonanalysis.config;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import java.util.Collections;
public class MybatisPlusGenerator {
private static final String url = "jdbc:mysql://localhost:3306/json?useAffectedRows=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull";
private static final String username = "root";
private static final String password = "123456";
public static void main(String[] args) {
FastAutoGenerator.create(url, username, password)
.globalConfig(builder -> {
builder.author("fsrm") // 设置作者
// .enableSwagger() // 开启 swagger 模式
.fileOverride() // 覆盖已生成文件
.outputDir("D://generator//"); // 指定输出目录
})
.packageConfig(builder -> {
builder.parent("com.springboot.springbootjsonanalysis") // 设置父包名
.moduleName("question") // 设置父包模块名
.pathInfo(Collections.singletonMap(OutputFile.xml, "D://generator//")); // 设置mapperXml生成路径
})
.strategyConfig(builder -> {
builder.addInclude("test_question") // 设置需要生成的表名
.addTablePrefix(); // 设置过滤表前缀
})
// .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
.execute();
}
}
MybatisPlus 代码生成器
最新推荐文章于 2024-07-19 17:37:28 发布