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")); } }