Commit 805f80c36a0a518ae1d918bf4a797a094673cd83
1 parent
af5520db
【功能优化】INFRA:代码生成时,默认禁用单元测试的生成,更符合大家的习惯
Showing
3 changed files
with
12 additions
and
0 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/codegen/config/CodegenProperties.java
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/inner/CodegenEngine.java
| ... | ... | @@ -398,6 +398,11 @@ public class CodegenEngine { |
| 398 | 398 | Map<String, String> templates = new LinkedHashMap<>(); |
| 399 | 399 | templates.putAll(SERVER_TEMPLATES); |
| 400 | 400 | templates.putAll(FRONT_TEMPLATES.row(frontType)); |
| 401 | + // 如果禁用单元测试,则移除对应的模版 | |
| 402 | + if (Boolean.FALSE.equals(codegenProperties.getUnitTestEnable())) { | |
| 403 | + templates.remove(javaTemplatePath("test/serviceTest")); | |
| 404 | + templates.remove("codegen/sql/h2.vm"); | |
| 405 | + } | |
| 401 | 406 | return templates; |
| 402 | 407 | } |
| 403 | 408 | ... | ... |
yudao-server/src/main/resources/application.yaml
| ... | ... | @@ -246,6 +246,7 @@ yudao: |
| 246 | 246 | base-package: ${yudao.info.base-package} |
| 247 | 247 | db-schemas: ${spring.datasource.dynamic.datasource.master.name} |
| 248 | 248 | front-type: 20 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类 |
| 249 | + unit-test-enable: false # 是否生成单元测试 | |
| 249 | 250 | tenant: # 多租户相关配置项 |
| 250 | 251 | enable: true |
| 251 | 252 | ignore-urls: | ... | ... |