package com.zhy.common;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.Collections;
import java.util.List;
public class code {
public static void main(String[] args) {
FastAutoGenerator.create("jdbc:mysql://localhost:3306/wms", "root", "123456")
.globalConfig(builder -> {
builder.author("zhy")
.outputDir(System.getProperty("user.dir")+"\\gkgl" + "\\src\\main\\java")
.enableSwagger()
.commentDate("yyyy-MM-dd")
.fileOverride();
})
.packageConfig(builder -> {
builder.parent("com.zhy")
.service("service")
.controller("controller")
.entity("entity")
.mapper("mapper")
.serviceImpl("service.impl")
.xml("mapper")
.pathInfo(Collections.singletonMap(OutputFile.mapperXml, System.getProperty("user.dir") + "src\\main\\resources\\mapper"));
})
.strategyConfig(builder -> {
builder.addInclude("user")
// .addTablePrefix() 前缀
.serviceBuilder()
.formatServiceFileName("%sService")
.formatServiceImplFileName("%sServiceImpl")
.entityBuilder()
.enableLombok()
.logicDeleteColumnName("deleted")
.enableTableFieldAnnotation()
.controllerBuilder()
.formatFileName("%sController")
.enableRestStyle()
.mapperBuilder()
.superClass(BaseMapper.class)
.formatMapperFileName("%sMapper")
.enableMapperAnnotation()
.formatXmlFileName("%sMapper");
})
.templateEngine(new FreemarkerTemplateEngine())
.execute();
}
}
MyBatis-plus 代码自动生成
最新推荐文章于 2024-07-23 08:26:35 发布