From 78b1ac4a60714704a86a3bba1ef6f57f9f82f9a5 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 30 Nov 2023 09:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=80=89=E6=8B=A9=E5=89=8D=E7=AB=AF=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/generator/domain/GenTable.java | 13 + .../service/GenTableServiceImpl.java | 6 +- .../ruoyi/generator/util/VelocityUtils.java | 16 +- .../mapper/generator/GenTableMapper.xml | 12 +- ruoyi-ui/src/views/tool/gen/genInfoForm.vue | 41 +- sql/{ry_20230706.sql => ry_20231130.sql} | 1397 +++++++++-------- 6 files changed, 761 insertions(+), 724 deletions(-) rename sql/{ry_20230706.sql => ry_20231130.sql} (98%) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 2abb94fa..c3af38f0 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -41,6 +41,9 @@ public class GenTable extends BaseEntity /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */ private String tplCategory; + /** 前端类型(element-ui模版 element-plus模版) */ + private String tplWebType; + /** 生成包路径 */ @NotBlank(message = "生成包路径不能为空") private String packageName; @@ -165,6 +168,16 @@ public class GenTable extends BaseEntity this.tplCategory = tplCategory; } + public String getTplWebType() + { + return tplWebType; + } + + public void setTplWebType(String tplWebType) + { + this.tplWebType = tplWebType; + } + public String getPackageName() { return packageName; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 1620995f..ff6291db 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -206,7 +206,7 @@ public class GenTableServiceImpl implements IGenTableService VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + List templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); for (String template : templates) { // 渲染模板 @@ -254,7 +254,7 @@ public class GenTableServiceImpl implements IGenTableService VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + List templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); for (String template : templates) { if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) @@ -367,7 +367,7 @@ public class GenTableServiceImpl implements IGenTableService VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + List templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); for (String template : templates) { // 渲染模板 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 733c7148..d64ab08f 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -123,11 +123,17 @@ public class VelocityUtils /** * 获取模板信息 - * + * @param tplCategory 生成的模板 + * @param tplWebType 前端类型 * @return 模板列表 */ - public static List getTemplateList(String tplCategory) + public static List getTemplateList(String tplCategory, String tplWebType) { + String useWebType = "vm/vue"; + if ("element-plus".equals(tplWebType)) + { + useWebType = "vm/vue/v3"; + } List templates = new ArrayList(); templates.add("vm/java/domain.java.vm"); templates.add("vm/java/mapper.java.vm"); @@ -139,15 +145,15 @@ public class VelocityUtils templates.add("vm/js/api.js.vm"); if (GenConstants.TPL_CRUD.equals(tplCategory)) { - templates.add("vm/vue/index.vue.vm"); + templates.add(useWebType + "/index.vue.vm"); } else if (GenConstants.TPL_TREE.equals(tplCategory)) { - templates.add("vm/vue/index-tree.vue.vm"); + templates.add(useWebType + "/index-tree.vue.vm"); } else if (GenConstants.TPL_SUB.equals(tplCategory)) { - templates.add("vm/vue/index.vue.vm"); + templates.add(useWebType + "/index.vue.vm"); templates.add("vm/java/sub-domain.java.vm"); } return templates; diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index a5d01454..9c65e4ca 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table + select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table