From 7a1e9b29aa74f0ae130f462af7bf2b1f15d17b3c Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 05 七月 2024 09:56:07 +0800 Subject: [PATCH] bug修改 --- code-generator/src/test/java/CodeGeneratorTests.java | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code-generator/src/test/java/CodeGeneratorTests.java b/code-generator/src/test/java/CodeGeneratorTests.java index f936b9f..114f066 100644 --- a/code-generator/src/test/java/CodeGeneratorTests.java +++ b/code-generator/src/test/java/CodeGeneratorTests.java @@ -2,15 +2,19 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.InjectionConfig; -import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.FileOutConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.TemplateConfig; import com.baomidou.mybatisplus.generator.config.po.LikeTable; import com.baomidou.mybatisplus.generator.config.po.TableFill; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import org.junit.Test; - import java.util.ArrayList; import java.util.List; +import org.junit.Test; /** * 通过指定 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) 可达到加速的效果。 @@ -26,7 +30,7 @@ // 防止误生成 - private static final String BASE_PACKAGE = "com.financial"; + private static final String BASE_PACKAGE = "com.ruoyi"; @Test public void contextLoads() { @@ -43,7 +47,7 @@ .setServiceName("%sService") .setServiceImplName("%sServiceImpl") .setControllerName("%sController") - .setOpen(false)//当代码生成完成之后是否打开代码所在的文件夹 + .setOpen(true)//当代码生成完成之后是否打开代码所在的文件夹 .setSwagger2(true) //实体属性 Swagger2 注解 .setFileOverride(true)//是否覆盖 //.setActiveRecord(true) @@ -70,7 +74,6 @@ pc.setEntity("model"); pc.setMapper("mapper"); pc.setService("service"); - // 自定义mapping文件生成路径配置 InjectionConfig cfg = new InjectionConfig() { @@ -107,14 +110,12 @@ //templateConfig.setController(null); //mpg.setTemplate(templateConfig); - // 策略配置 StrategyConfig strategy = new StrategyConfig(); //设置字段和表名的是否把下划线完成驼峰命名规则 strategy.setNaming(NamingStrategy.underline_to_camel); strategy.setEntitySerialVersionUID(true); strategy.setEntityColumnConstant(false); - //设置生成的实体类继承的父类 // strategy.setSuperEntityClass(BaseModel.class); @@ -144,7 +145,7 @@ // strategy.setTablePrefix(pc.getModuleName() + ""); // strategy.setLikeTable(new LikeTable("room")); //strategy.setLikeTable(new LikeTable("member")); - strategy.setLikeTable(new LikeTable("tb_"));// 生成表名 + strategy.setLikeTable(new LikeTable("tb_data_screen_score"));// 生成表名 // strategy.setLikeTable(new LikeTable("t_hotel"));// 生成表名 // strategy.setLikeTable(new LikeTable("t_scan_message"));// 生成表名 // strategy.setNotLikeTable(new LikeTable("tb_dept"));// 不生成表名 -- Gitblit v1.7.1