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 b4dd7642444e30a7256b47adc489f815c0836be1..d5b87d78a98701b35eda5f813be48274e946845d 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 18bdbdb598e721f3d10f1bbfa38a72f8b2d8d044..341362317670aa99513d9d829e3e418d22063328 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
new file mode 100644
index 0000000000000000000000000000000000000000..74689a2c6c412204f37350b805028e4d86f3ae65
--- /dev/null
+++ b/src/main/java/neatlogic/framework/matrix/dto/MatrixCmdbCustomViewVo.java
@@ -0,0 +1,76 @@
+/*
+ * 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;
+
+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/dto/MatrixVo.java b/src/main/java/neatlogic/framework/matrix/dto/MatrixVo.java
index bb900dfcd344dad3ea7269bbba9370b6c258ddbb..727a39f95b41b5c9d93e8ca889a3eaa7c06ebad0 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;
}
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 0000000000000000000000000000000000000000..53b0e51aa4c8cf730680d3596a056468fc49f6ae
--- /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);
+ }
+}