From 34ef99751454c4d31f16037201ec0f7bdacb3474 Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Sat, 7 Oct 2023 23:24:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=BB=E6=9C=BA=E7=A7=98?= =?UTF-8?q?=E9=92=A5=E5=8D=A1=E7=89=87=E8=A7=86=E5=9B=BE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ops/launch/generator/CodeGenerator.java | 8 +- .../engine/VelocityTemplateEngine.java | 16 +-- .../orion-server-module-service-impl.java.vm | 2 +- .../resources/templates/orion-sql-menu.sql.vm | 3 +- ...rion-vue-views-components-card-list.vue.vm | 11 +- .../templates/orion-vue-views-index.vue.vm | 17 +-- .../orion-vue-views-types-card.fields.ts.vm | 33 ++++- .../request/host/HostKeyQueryRequest.java | 3 + .../service/impl/HostKeyServiceImpl.java | 7 +- .../asset/service/impl/HostServiceImpl.java | 4 +- orion-ops-ui/src/api/asset/host-key.ts | 1 + orion-ops-ui/src/assets/style/layout.less | 2 +- .../src/components/card/list/index.vue | 4 +- .../components/host-key-card-list.vue | 132 ++++++++++++++++++ .../src/views/asset/host-key/index.vue | 41 +++++- .../views/asset/host-key/types/card.fields.ts | 30 ++++ .../asset/host/components/host-card-list.vue | 5 +- .../src/views/asset/host/types/card.fields.ts | 2 +- 18 files changed, 281 insertions(+), 40 deletions(-) create mode 100644 orion-ops-ui/src/views/asset/host-key/components/host-key-card-list.vue create mode 100644 orion-ops-ui/src/views/asset/host-key/types/card.fields.ts diff --git a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java index d265f752..93fe73de 100644 --- a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java +++ b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/CodeGenerator.java @@ -18,6 +18,7 @@ import com.orion.ops.framework.mybatis.core.domain.BaseDO; import com.orion.ops.framework.mybatis.core.mapper.IMapper; import com.orion.ops.launch.generator.engine.VelocityTemplateEngine; import com.orion.ops.launch.generator.template.Table; +import com.orion.ops.launch.generator.template.Template; import org.apache.ibatis.annotations.Mapper; import java.io.File; @@ -41,7 +42,7 @@ public class CodeGenerator { // 作者 String author = Const.ORION_AUTHOR; // 模块 - String module = "infra"; + String module = "asset"; // 生成的表 Table[] tables = { // Template.create("preference", "用户偏好", "preference") @@ -55,6 +56,11 @@ public class CodeGenerator { // .values("value", 1, 2) // .color("blue", "green") // .build(), + Template.create("host_key", "主机秘钥", "host") + .vue("asset", "host-key") + .enableCardView() + .enableDrawerForm() + .build() }; // jdbc 配置 - 使用配置文件 File yamlFile = new File("orion-ops-launch/src/main/resources/application-dev.yaml"); diff --git a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/engine/VelocityTemplateEngine.java b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/engine/VelocityTemplateEngine.java index f1158ba5..d156ea62 100644 --- a/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/engine/VelocityTemplateEngine.java +++ b/orion-ops-launch/src/main/java/com/orion/ops/launch/generator/engine/VelocityTemplateEngine.java @@ -138,13 +138,13 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine { @NotNull TableInfo tableInfo) { // 生成文件副本 List files = originCustomerFile.stream().map(s -> - new CustomFile.Builder() - .enableFileOverride() - .templatePath(s.getTemplatePath()) - .filePath(s.getFilePath()) - .fileName(s.getFileName()) - .packageName(s.getPackageName()) - .build()) + new CustomFile.Builder() + .enableFileOverride() + .templatePath(s.getTemplatePath()) + .filePath(s.getFilePath()) + .fileName(s.getFileName()) + .packageName(s.getPackageName()) + .build()) .collect(Collectors.toList()); // 获取 table Table table = tables.get(tableInfo.getName()); @@ -324,7 +324,7 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine { .collect(Collectors.toList()); // 设置前端元数据 Table table = tables.get(tableInfo.getName()); - Map vueMeta = this.pickTableMeta(table, "enableDrawerForm", "enableRowSelection", "module", "feature"); + Map vueMeta = this.pickTableMeta(table, "module", "feature", "enableDrawerForm", "enableRowSelection", "enableCardView"); // 模块名称实体 vueMeta.put("moduleEntity", VariableStyles.SPINE.toBigHump(table.getModule())); // 模块名称实体 diff --git a/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm b/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm index f071d48d..b19412cc 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm @@ -270,7 +270,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} { #end .and(Strings.isNotEmpty(searchValue), c -> c #foreach($field in ${table.fields}) - .eq(${type}DO::get${field.capitalName}, searchValue) + .eq(${type}DO::get${field.capitalName}, searchValue)#if($foreach.hasNext).or()#end #end ); } diff --git a/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm b/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm index 05fb4fa6..cc2c6305 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-sql-menu.sql.vm @@ -26,4 +26,5 @@ VALUES (@TMP_SUB_ID, '创建$table.comment', '${package.ModuleName}:${typeHyphen}:create', 3, 20), (@TMP_SUB_ID, '修改$table.comment', '${package.ModuleName}:${typeHyphen}:update', 3, 30), (@TMP_SUB_ID, '删除$table.comment', '${package.ModuleName}:${typeHyphen}:delete', 3, 40), - (@TMP_SUB_ID, '导出$table.comment', '${package.ModuleName}:${typeHyphen}:export', 3, 50); + (@TMP_SUB_ID, '导出$table.comment', '${package.ModuleName}:${typeHyphen}:export', 3, 50), + (@TMP_SUB_ID, '导入$table.comment', '${package.ModuleName}:${typeHyphen}:import', 3, 60); diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm index e5ee33d7..5c2c0d13 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm @@ -1,5 +1,6 @@