【功能优化】INFRA:代码生成时,默认禁用单元测试的生成,更符合大家的习惯
parent
94125441af
commit
f6a1f732f6
|
@ -34,4 +34,10 @@ public class CodegenProperties {
|
|||
@NotNull(message = "代码生成的前端类型不能为空")
|
||||
private Integer frontType;
|
||||
|
||||
/**
|
||||
* 是否生成单元测试
|
||||
*/
|
||||
@NotNull(message = "是否生成单元测试不能为空")
|
||||
private Boolean unitTestEnable;
|
||||
|
||||
}
|
||||
|
|
|
@ -398,6 +398,11 @@ public class CodegenEngine {
|
|||
Map<String, String> templates = new LinkedHashMap<>();
|
||||
templates.putAll(SERVER_TEMPLATES);
|
||||
templates.putAll(FRONT_TEMPLATES.row(frontType));
|
||||
// 如果禁用单元测试,则移除对应的模版
|
||||
if (Boolean.FALSE.equals(codegenProperties.getUnitTestEnable())) {
|
||||
templates.remove(javaTemplatePath("test/serviceTest"));
|
||||
templates.remove("codegen/sql/h2.vm");
|
||||
}
|
||||
return templates;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ yudao:
|
|||
base-package: cn.iocoder.yudao
|
||||
db-schemas: ${spring.datasource.dynamic.datasource.master.name}
|
||||
front-type: 20 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类
|
||||
unit-test-enable: false # 是否生成单元测试
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
ignore-urls:
|
||||
|
|
Loading…
Reference in New Issue