From 77bb57a2eecf741516606d367b2b5d03c7ff8d44 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 11 Feb 2021 11:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=88=B6=E4=BD=9C=20vue=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/vm/vue/index-tree.vue.vm | 506 -------- .../codegen/impl/ToolCodegenEngine.java | 10 + .../codegen/java/controller/vo/pageReqVO.vm | 2 +- .../resources/codegen/vue/views}/index.vue.vm | 1074 ++++++++--------- .../codegen/impl/ToolCodegenEngineTest.java | 6 +- 5 files changed, 551 insertions(+), 1047 deletions(-) delete mode 100644 ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm rename {ruoyi-generator/src/main/resources/vm/vue => src/main/resources/codegen/vue/views}/index.vue.vm (73%) diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm deleted file mode 100644 index 9c31d0d6a..000000000 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ /dev/null @@ -1,506 +0,0 @@ - - - diff --git a/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngine.java b/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngine.java index 185001451..f56374809 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngine.java +++ b/src/main/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngine.java @@ -72,6 +72,8 @@ public class ToolCodegenEngine { .put(javaTemplatePath("service/serviceImpl"), javaFilePath("service/${table.businessName}/impl/${table.className}ServiceImpl")) // Vue + .put(vueTemplatePath("views/index.vue"), + vueFilePath("views/${table.moduleName}/${table.businessName}/index.vue")) // SQL .build(); @@ -161,4 +163,12 @@ public class ToolCodegenEngine { return "java/${basePackage}/${table.moduleName}/" + path + ".java"; } + private static String vueTemplatePath(String path) { + return "codegen/vue/" + path + ".vm"; + } + + private static String vueFilePath(String path) { + return "vue/" + path; + } + } diff --git a/src/main/resources/codegen/java/controller/vo/pageReqVO.vm b/src/main/resources/codegen/java/controller/vo/pageReqVO.vm index 1fe25b9c1..71630742e 100644 --- a/src/main/resources/codegen/java/controller/vo/pageReqVO.vm +++ b/src/main/resources/codegen/java/controller/vo/pageReqVO.vm @@ -36,7 +36,7 @@ public class ${table.className}PageReqVO extends PageParam { #columnTpl('end', '结束') #else##情况二,非 Between 的时间 -#columnTpl('', '') + #columnTpl('', '') #end #end diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/src/main/resources/codegen/vue/views/index.vue.vm similarity index 73% rename from ruoyi-generator/src/main/resources/vm/vue/index.vue.vm rename to src/main/resources/codegen/vue/views/index.vue.vm index 8ff104711..4e091361e 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/src/main/resources/codegen/vue/views/index.vue.vm @@ -1,538 +1,536 @@ - - - + + + diff --git a/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java b/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java index 4036ed8ea..cd41bd133 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/tool/service/codegen/impl/ToolCodegenEngineTest.java @@ -10,6 +10,7 @@ import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; import java.util.List; +import java.util.Map; @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ToolCodegenEngineTest { @@ -24,9 +25,10 @@ public class ToolCodegenEngineTest { @Test public void testExecute() { - ToolCodegenTableDO table = codegenTableMapper.selectById(14); + ToolCodegenTableDO table = codegenTableMapper.selectById(10); List columns = codegenColumnMapper.selectListByTableId(table.getId()); - codegenEngine.execute(table, columns); + Map result = codegenEngine.execute(table, columns); + System.out.println(result.get("vue/views/system/test/index.vue")); } }