From 3da0446a7c111eada7f1f0a247fbe6d9b88bb2c7 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Wed, 20 Mar 2024 18:15:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E7=9F=A9=E9=98=B5-=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A7=86?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1115260319137792]系统设置-矩阵-数据源增加自定义视图 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1115260319137792 --- .../matrix/dto/MatrixCmdbCustomViewVo.java | 21 +++++++++++++++++++ .../framework/matrix/dto/MatrixVo.java | 10 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java diff --git a/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java b/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java new file mode 100644 index 000000000..bac5296ec --- /dev/null +++ b/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.matrix.dto; + +public class MatrixCmdbCustomViewVo { +} diff --git a/src/main/java/neatlogic/framework/matrix/dto/MatrixVo.java b/src/main/java/neatlogic/framework/matrix/dto/MatrixVo.java index bb900dfcd..727a39f95 100644 --- a/src/main/java/neatlogic/framework/matrix/dto/MatrixVo.java +++ b/src/main/java/neatlogic/framework/matrix/dto/MatrixVo.java @@ -36,6 +36,8 @@ public class MatrixVo extends BaseEditorVo { private String fileName; @EntityField( name = "ci模型id", type = ApiParamType.LONG) private Long ciId; + @EntityField( name = "CMDB自定义视图ID", type = ApiParamType.LONG) + private Long customViewId; @EntityField( name = "配置信息", type = ApiParamType.JSONOBJECT) private JSONObject config; @@ -131,6 +133,14 @@ public class MatrixVo extends BaseEditorVo { this.ciId = ciId; } + public Long getCustomViewId() { + return customViewId; + } + + public void setCustomViewId(Long customViewId) { + this.customViewId = customViewId; + } + public JSONObject getConfig() { return config; } -- Gitee From 0a284f63293b4b3ae552e7f3ed184fdb825298c0 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Thu, 21 Mar 2024 16:19:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E7=9F=A9=E9=98=B5-=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A7=86?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1115260319137792]系统设置-矩阵-数据源增加自定义视图 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1115260319137792 --- .../matrix/dao/mapper/MatrixMapper.java | 11 ++-- .../matrix/dao/mapper/MatrixMapper.xml | 25 +++++++++ .../matrix/dto/MatrixCmdbCustomViewVo.java | 55 +++++++++++++++++++ ...MatrixCmdbCustomViewNotFoundException.java | 10 ++++ 4 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 src/main/java/neatlogic/framework/matrix/exception/MatrixCmdbCustomViewNotFoundException.java diff --git a/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.java b/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.java index b4dd76424..d5b87d78a 100644 --- a/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.java +++ b/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.java @@ -1,10 +1,7 @@ package neatlogic.framework.matrix.dao.mapper; import neatlogic.framework.common.dto.BasePageVo; -import neatlogic.framework.matrix.dto.MatrixCiVo; -import neatlogic.framework.matrix.dto.MatrixExternalVo; -import neatlogic.framework.matrix.dto.MatrixViewVo; -import neatlogic.framework.matrix.dto.MatrixVo; +import neatlogic.framework.matrix.dto.*; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -42,6 +39,8 @@ public interface MatrixMapper { MatrixCiVo getMatrixCiByMatrixUuid(String matrixUuid); + MatrixCmdbCustomViewVo getMatrixCmdbCustomViewByMatrixUuid(String matrixUuid); + int insertMatrix(MatrixVo matrixVo); int replaceMatrixExternal(MatrixExternalVo matrixExternalVo); @@ -50,6 +49,8 @@ public interface MatrixMapper { int replaceMatrixCi(MatrixCiVo matrixCiVo); + int replaceMatrixCmdbCustomView(MatrixCmdbCustomViewVo matrixCmdbCustomViewVo); + int updateMatrixNameAndLcu(MatrixVo matrixVo); int deleteMatrixByUuid(String uuid); @@ -59,4 +60,6 @@ public interface MatrixMapper { int deleteMatrixViewByMatrixUuid(String matrixUuid); int deleteMatrixCiByMatrixUuid(String matrixUuid); + + int deleteMatrixCmdbCustomViewByMatrixUuid(String matrixUuid); } diff --git a/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.xml b/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.xml index 18bdbdb59..341362317 100644 --- a/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.xml +++ b/src/main/java/neatlogic/framework/matrix/dao/mapper/MatrixMapper.xml @@ -154,6 +154,15 @@ WHERE `matrix_uuid` = #{matrixUuid} + + select LAST_INSERT_ID() as id @@ -219,6 +228,18 @@ ) + + REPLACE INTO `matrix_cmdb_custom_view`( + `matrix_uuid`, + `custom_view_id`, + `config` + ) VALUES ( + #{matrixUuid}, + #{customViewId}, + #{configStr} + ) + + UPDATE `matrix` SET `name` = #{name}, @@ -242,4 +263,8 @@ DELETE FROM `matrix_ci` WHERE `matrix_uuid` = #{value} + + + DELETE FROM `matrix_cmdb_custom_view` WHERE `matrix_uuid` = #{value} + diff --git a/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java b/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java index bac5296ec..74689a2c6 100644 --- a/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java +++ b/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java @@ -17,5 +17,60 @@ package neatlogic.framework.matrix.dto; +import com.alibaba.fastjson.JSONObject; + public class MatrixCmdbCustomViewVo { + + private String matrixUuid; + + private Long customViewId; + private JSONObject config; + private String configStr; + + public MatrixCmdbCustomViewVo() { + } + + public MatrixCmdbCustomViewVo(String matrixUuid, Long customViewId, JSONObject config) { + this.matrixUuid = matrixUuid; + this.customViewId = customViewId; + this.config = config; + } + + public String getMatrixUuid() { + return matrixUuid; + } + + public void setMatrixUuid(String matrixUuid) { + this.matrixUuid = matrixUuid; + } + + public Long getCustomViewId() { + return customViewId; + } + + public void setCustomViewId(Long customViewId) { + this.customViewId = customViewId; + } + + public JSONObject getConfig() { + if (config == null && configStr != null) { + config = JSONObject.parseObject(configStr); + } + return config; + } + + public void setConfig(JSONObject config) { + this.config = config; + } + + public String getConfigStr() { + if (configStr == null && config != null) { + configStr = config.toJSONString(); + } + return configStr; + } + + public void setConfigStr(String configStr) { + this.configStr = configStr; + } } diff --git a/src/main/java/neatlogic/framework/matrix/exception/MatrixCmdbCustomViewNotFoundException.java b/src/main/java/neatlogic/framework/matrix/exception/MatrixCmdbCustomViewNotFoundException.java new file mode 100644 index 000000000..53b0e51aa --- /dev/null +++ b/src/main/java/neatlogic/framework/matrix/exception/MatrixCmdbCustomViewNotFoundException.java @@ -0,0 +1,10 @@ +package neatlogic.framework.matrix.exception; + +import neatlogic.framework.exception.core.ApiRuntimeException; + +public class MatrixCmdbCustomViewNotFoundException extends ApiRuntimeException { + + public MatrixCmdbCustomViewNotFoundException(String name) { + super("矩阵:{0}的自定义视图配置信息不存在", name); + } +} -- Gitee