package com.bt.springboot.generator;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import java.util.Collections;
public class MybatisPlusGenerator {
private static final String URL = "";
private static final String USERNAME = "";
private static final String PASSWORD = "";
private static final String AUTHOR = "";
private static final String OUTPUT_DIR = "";
private static final String PARENT = "";
private static final String MODULE_NAME = "";
private static final String PATH_INFO = "";
private static final String TABLE_NAME = "";
public static void main(String[] args) {
FastAutoGenerator.create(URL, USERNAME, PASSWORD)
.globalConfig(builder -> {
builder.author(AUTHOR)
.fileOverride()
.dateType(DateType.TIME_PACK)
.disableOpenDir()
.commentDate("yyyy-MM-dd")
.outputDir(OUTPUT_DIR);
})
.packageConfig(builder -> {
builder.parent(PARENT)
.moduleName(MODULE_NAME)
.pathInfo(Collections.singletonMap(OutputFile.xml, PATH_INFO));
})
.strategyConfig(builder -> {
builder.addInclude(TABLE_NAME)
.enableCapitalMode()
.entityBuilder()
.enableLombok()
.enableChainModel()
.naming(NamingStrategy.underline_to_camel)
.enableTableFieldAnnotation()
.serviceBuilder()
.formatServiceFileName("%sService");
})
.templateEngine(new VelocityTemplateEngine())
.execute();
}
}

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91