导包:
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-freemarker</artifactId></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-generator</artifactId><version>3.5.3</version></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.0</version></dependency>
问题:
@Testpublic void test02(){System.out.println("url = " + url);FastAutoGenerator.create(url, "root", "root").globalConfig(builder -> {builder.author("cc") // 设置作者
// .enableSwagger() // 开启 swagger 模式
// .fileOverride() // 覆盖已生成文件.outputDir("I:\\ruoyi-annotation\\src\\main\\java"); // 指定输出目录}).packageConfig(builder -> {builder.parent("com.cj") // 设置父包名
// .moduleName("system") // 设置父包模块名.pathInfo(Collections.singletonMap(OutputFile.xml, "I:\\ruoyi-annotation\\src\\main\\resources\\mapper")); // 设置mapperXml生成路径}).strategyConfig(builder -> {
//builder.addInclude("sys_user","sys_role","sys_dept").addTablePrefix("sys_").entityBuilder().enableFileOverride().serviceBuilder().enableFileOverride().mapperBuilder().enableFileOverride().controllerBuilder().enableFileOverride();}).templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板.execute();}
引用:https://blog.csdn.net/haohaounique/article/details/127837673