use of com.baomidou.mybatisplus.generator.FastAutoGenerator in project code-generator-maven-plugin by mengweijin.
the class DefaultAutoGenerator method execute.
public void execute() {
Parameters parameters = projectInfo.getParameters();
String outputDir = FileUtil.file(projectInfo.getBaseDir(), "target/code-generator/").getAbsolutePath();
// clean directory target/code-generator
FileUtil.del(outputDir);
FastAutoGenerator fastAutoGenerator = FastAutoGenerator.create(dataSourceConfigBuilder()).globalConfig(builder -> builder.fileOverride().author(parameters.getAuthor()).enableSwagger().disableOpenDir().outputDir(outputDir).dateType(DateType.TIME_PACK).commentDate("yyyy-MM-dd")).packageConfig(builder -> builder.parent(parameters.getOutputPackage())).templateConfig((Consumer<TemplateConfig.Builder>) TemplateConfig.Builder::disable).strategyConfig(builder -> builder.addInclude(this.trimItemName(parameters.getTables())).addTablePrefix(this.trimItemName(parameters.getTablePrefix())).entityBuilder().superClass(parameters.getSuperEntityClass()).enableChainModel().enableLombok().enableTableFieldAnnotation().versionColumnName("version").versionPropertyName("version").logicDeleteColumnName("deleted").logicDeletePropertyName("deleted").naming(NamingStrategy.underline_to_camel).addSuperEntityColumns(this.generateDefaultSuperEntityColumns()).controllerBuilder().superClass(parameters.getSuperControllerClass()).enableHyphenStyle().enableRestStyle().serviceBuilder().superServiceClass(parameters.getSuperServiceClass()).superServiceImplClass(parameters.getSuperServiceImplClass()).mapperBuilder().superClass(parameters.getSuperDaoClass()).enableBaseColumnList().enableBaseResultMap()).injectionConfig(builder -> {
builder.beforeOutputFile(((tableInfo, objectMap) -> {
enhanceObjectMap(objectMap, parameters);
FileOutput.outputFile(tableInfo, objectMap, projectInfo, outputDir);
}));
}).templateEngine(TemplateEngineFactory.getTemplateEngine(this.projectInfo.getParameters().getTemplateType()));
fastAutoGenerator.execute();
}
Aggregations