This is an automated email from the ASF dual-hosted git repository.

casion pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
     new 78c83b359 [ISSUE-2442][linkis-basedata-manager] engine config template 
manage (#3865)
78c83b359 is described below

commit 78c83b35987a9b6b80dee0fba24d71022d171279
Author: ichenfeiyang <[email protected]>
AuthorDate: Sun Dec 4 17:21:01 2022 +0800

    [ISSUE-2442][linkis-basedata-manager] engine config template manage (#3865)
    
    * [ISSUE-2442] Basic data management, add interface
    
    * [ISSUE-2442] add interface: getEngineList&getTemplateListByLabelId
    
    * [ISSUE-2442] insert engine label when create second category
    
    * [ISSUE-2442] update save configuration template interface
    
    * [ISSUE-2442] add licenses
    
    * [ISSUE-2442] add audit log and key logs
    
    Co-authored-by: ichenfeiyang <[email protected]>
---
 .../server/dao/CgManagerLabelMapper.java           |  33 ++++
 .../server/dao/ConfigurationConfigKeyMapper.java   |  37 +++++
 .../server/dao/ConfigurationConfigValueMapper.java |  31 ++++
 .../dao/ConfigurationKeyEngineRelationMapper.java  |  30 ++++
 .../server/dao/mapper/CgManagerLabelMapper.xml     |  26 +++
 .../dao/mapper/ConfigurationConfigKeyMapper.xml    |  41 +++++
 .../dao/mapper/ConfigurationConfigValueMapper.xml  |  32 ++++
 .../ConfigurationKeyEngineRelationMapper.xml       |  26 +++
 .../server/domain/CgManagerLabel.java              | 120 ++++++++++++++
 .../server/domain/ConfigurationConfigKey.java      | 155 ++++++++++++++++++
 .../server/domain/ConfigurationConfigValue.java    |  92 +++++++++++
 .../domain/ConfigurationKeyEngineRelation.java     |  61 +++++++
 .../request/ConfigurationTemplateSaveRequest.java  | 175 +++++++++++++++++++++
 .../server/response/EngineLabelResponse.java       |  56 +++++++
 .../restful/ConfigurationTemplateRestfulApi.java   | 101 ++++++++++++
 .../service/ConfigurationTemplateService.java      |  59 +++++++
 .../impl/ConfigurationTemplateServiceImpl.java     | 138 ++++++++++++++++
 .../configuration/service/CategoryService.scala    |   3 +
 .../service/ConfigurationService.scala             |  11 ++
 19 files changed, 1227 insertions(+)

diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/CgManagerLabelMapper.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/CgManagerLabelMapper.java
new file mode 100644
index 000000000..b0cc79d00
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/CgManagerLabelMapper.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.dao;
+
+import org.apache.linkis.basedatamanager.server.domain.CgManagerLabel;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface CgManagerLabelMapper extends BaseMapper<CgManagerLabel> {
+  /**
+   * query a engine label list
+   *
+   * @return List
+   */
+  List<CgManagerLabel> getEngineList();
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationConfigKeyMapper.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationConfigKeyMapper.java
new file mode 100644
index 000000000..53be89ea8
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationConfigKeyMapper.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.dao;
+
+import org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigKey;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface ConfigurationConfigKeyMapper extends 
BaseMapper<ConfigurationConfigKey> {
+  /**
+   * query config key list by engine label id
+   *
+   * @param engineLabelId engine label id
+   * @return List
+   */
+  List<ConfigurationConfigKey> getTemplateListByLabelId(
+      @Param("engineLabelId") String engineLabelId);
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationConfigValueMapper.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationConfigValueMapper.java
new file mode 100644
index 000000000..d95e9a685
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationConfigValueMapper.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.dao;
+
+import 
org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigValue;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface ConfigurationConfigValueMapper extends 
BaseMapper<ConfigurationConfigValue> {
+
+  int updateByKeyId(@Param("configValue") ConfigurationConfigValue 
configValue);
+
+  int deleteByKeyId(@Param("keyId") Long keyId);
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationKeyEngineRelationMapper.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationKeyEngineRelationMapper.java
new file mode 100644
index 000000000..46c7cffbf
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/ConfigurationKeyEngineRelationMapper.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.dao;
+
+import 
org.apache.linkis.basedatamanager.server.domain.ConfigurationKeyEngineRelation;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+public interface ConfigurationKeyEngineRelationMapper
+    extends BaseMapper<ConfigurationKeyEngineRelation> {
+
+  int deleteByKeyId(@Param("keyId") Long keyId);
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/CgManagerLabelMapper.xml
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/CgManagerLabelMapper.xml
new file mode 100644
index 000000000..3d7aceecc
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/CgManagerLabelMapper.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+<mapper 
namespace="org.apache.linkis.basedatamanager.server.dao.CgManagerLabelMapper">
+    <!-- query a engine label list -->
+    <select id="getEngineList" 
resultType="org.apache.linkis.basedatamanager.server.domain.CgManagerLabel">
+        select a.id, a.label_key, a.label_value, a.label_feature
+        from linkis_cg_manager_label a
+        where a.label_value like '*_*,%';
+    </select>
+</mapper>
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationConfigKeyMapper.xml
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationConfigKeyMapper.xml
new file mode 100644
index 000000000..4c4ae8e8b
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationConfigKeyMapper.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+<mapper 
namespace="org.apache.linkis.basedatamanager.server.dao.ConfigurationConfigKeyMapper">
+    <!-- query config key list by engine label id -->
+    <select id="getTemplateListByLabelId"
+            
resultType="org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigKey"
+            parameterType="java.lang.String">
+        select k.id,
+               k.`key`,
+               k.description,
+               k.`name`,
+               k.default_value,
+               k.validate_type,
+               k.validate_range,
+               k.engine_conn_type,
+               k.is_hidden   hidden,
+               k.is_advanced advanced,
+               k.`level`,
+               k.treeName
+        from linkis_ps_configuration_config_key k
+                 inner join linkis_ps_configuration_key_engine_relation r
+                            on k.id = r.config_key_id
+        where r.engine_type_label_id = #{engineLabelId};
+    </select>
+</mapper>
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationConfigValueMapper.xml
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationConfigValueMapper.xml
new file mode 100644
index 000000000..9678d4f15
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationConfigValueMapper.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+<mapper 
namespace="org.apache.linkis.basedatamanager.server.dao.ConfigurationConfigValueMapper">
+
+    <update id="updateByKeyId"
+            
parameterType="org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigValue">
+        update linkis_ps_configuration_config_value
+        set config_value = #{configValue.configValue}
+        where config_key_id = #{configValue.configKeyId}
+    </update>
+    <delete id="deleteByKeyId" parameterType="java.lang.Long">
+        delete
+        from linkis_ps_configuration_config_value
+        where config_key_id = #{keyId}
+    </delete>
+</mapper>
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationKeyEngineRelationMapper.xml
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationKeyEngineRelationMapper.xml
new file mode 100644
index 000000000..c4ef06107
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/dao/mapper/ConfigurationKeyEngineRelationMapper.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
+<mapper 
namespace="org.apache.linkis.basedatamanager.server.dao.ConfigurationKeyEngineRelationMapper">
+
+    <delete id="deleteByKeyId" parameterType="java.lang.Long">
+        delete
+        from linkis_ps_configuration_key_engine_relation
+        where config_key_id = #{keyId}
+    </delete>
+</mapper>
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/CgManagerLabel.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/CgManagerLabel.java
new file mode 100644
index 000000000..dbc600c2c
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/CgManagerLabel.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.domain;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("linkis_cg_manager_label")
+public class CgManagerLabel implements Serializable {
+
+  @TableId(value = "id", type = IdType.AUTO)
+  private Integer id;
+
+  private String labelKey;
+
+  private String labelValue;
+
+  private String labelFeature;
+
+  private Integer labelValueSize;
+
+  private LocalDateTime updateTime;
+
+  private LocalDateTime createTime;
+
+  public Integer getId() {
+    return id;
+  }
+
+  public void setId(Integer id) {
+    this.id = id;
+  }
+
+  public String getLabelKey() {
+    return labelKey;
+  }
+
+  public void setLabelKey(String labelKey) {
+    this.labelKey = labelKey;
+  }
+
+  public String getLabelValue() {
+    return labelValue;
+  }
+
+  public void setLabelValue(String labelValue) {
+    this.labelValue = labelValue;
+  }
+
+  public String getLabelFeature() {
+    return labelFeature;
+  }
+
+  public void setLabelFeature(String labelFeature) {
+    this.labelFeature = labelFeature;
+  }
+
+  public Integer getLabelValueSize() {
+    return labelValueSize;
+  }
+
+  public void setLabelValueSize(Integer labelValueSize) {
+    this.labelValueSize = labelValueSize;
+  }
+
+  public LocalDateTime getUpdateTime() {
+    return updateTime;
+  }
+
+  public void setUpdateTime(LocalDateTime updateTime) {
+    this.updateTime = updateTime;
+  }
+
+  public LocalDateTime getCreateTime() {
+    return createTime;
+  }
+
+  public void setCreateTime(LocalDateTime createTime) {
+    this.createTime = createTime;
+  }
+
+  @Override
+  public String toString() {
+    return "LinkisCgManagerLabel{"
+        + "id="
+        + id
+        + ", labelKey="
+        + labelKey
+        + ", labelValue="
+        + labelValue
+        + ", labelFeature="
+        + labelFeature
+        + ", labelValueSize="
+        + labelValueSize
+        + ", updateTime="
+        + updateTime
+        + ", createTime="
+        + createTime
+        + "}";
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationConfigKey.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationConfigKey.java
new file mode 100644
index 000000000..4f6612162
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationConfigKey.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.domain;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("linkis_ps_configuration_config_key")
+public class ConfigurationConfigKey implements Serializable {
+
+  @TableId(value = "id", type = IdType.AUTO)
+  private Long id;
+
+  @TableField("`key`")
+  private String key;
+
+  private String description;
+
+  private String name;
+
+  private String defaultValue;
+
+  private String validateType;
+
+  private String validateRange;
+
+  private String engineConnType;
+
+  @TableField("is_hidden")
+  private Integer hidden;
+
+  @TableField("is_advanced")
+  private Integer advanced;
+
+  @TableField("`level`")
+  private Integer level;
+
+  @TableField("treeName")
+  private String treeName;
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getKey() {
+    return key;
+  }
+
+  public void setKey(String key) {
+    this.key = key;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getDefaultValue() {
+    return defaultValue;
+  }
+
+  public void setDefaultValue(String defaultValue) {
+    this.defaultValue = defaultValue;
+  }
+
+  public String getValidateType() {
+    return validateType;
+  }
+
+  public void setValidateType(String validateType) {
+    this.validateType = validateType;
+  }
+
+  public String getValidateRange() {
+    return validateRange;
+  }
+
+  public void setValidateRange(String validateRange) {
+    this.validateRange = validateRange;
+  }
+
+  public String getEngineConnType() {
+    return engineConnType;
+  }
+
+  public void setEngineConnType(String engineConnType) {
+    this.engineConnType = engineConnType;
+  }
+
+  public Integer getHidden() {
+    return hidden;
+  }
+
+  public void setHidden(Integer hidden) {
+    this.hidden = hidden;
+  }
+
+  public Integer getAdvanced() {
+    return advanced;
+  }
+
+  public void setAdvanced(Integer advanced) {
+    this.advanced = advanced;
+  }
+
+  public Integer getLevel() {
+    return level;
+  }
+
+  public void setLevel(Integer level) {
+    this.level = level;
+  }
+
+  public String getTreeName() {
+    return treeName;
+  }
+
+  public void setTreeName(String treeName) {
+    this.treeName = treeName;
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationConfigValue.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationConfigValue.java
new file mode 100644
index 000000000..01148b3a5
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationConfigValue.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.domain;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("linkis_ps_configuration_config_value")
+public class ConfigurationConfigValue implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  @TableId(value = "id", type = IdType.AUTO)
+  private Long id;
+
+  private Long configKeyId;
+
+  private String configValue;
+
+  private Integer configLabelId;
+
+  private LocalDateTime updateTime;
+
+  private LocalDateTime createTime;
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public Long getConfigKeyId() {
+    return configKeyId;
+  }
+
+  public void setConfigKeyId(Long configKeyId) {
+    this.configKeyId = configKeyId;
+  }
+
+  public String getConfigValue() {
+    return configValue;
+  }
+
+  public void setConfigValue(String configValue) {
+    this.configValue = configValue;
+  }
+
+  public Integer getConfigLabelId() {
+    return configLabelId;
+  }
+
+  public void setConfigLabelId(Integer configLabelId) {
+    this.configLabelId = configLabelId;
+  }
+
+  public LocalDateTime getUpdateTime() {
+    return updateTime;
+  }
+
+  public void setUpdateTime(LocalDateTime updateTime) {
+    this.updateTime = updateTime;
+  }
+
+  public LocalDateTime getCreateTime() {
+    return createTime;
+  }
+
+  public void setCreateTime(LocalDateTime createTime) {
+    this.createTime = createTime;
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationKeyEngineRelation.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationKeyEngineRelation.java
new file mode 100644
index 000000000..55336df60
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/domain/ConfigurationKeyEngineRelation.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.domain;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+@TableName("linkis_ps_configuration_key_engine_relation")
+public class ConfigurationKeyEngineRelation implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  @TableId(value = "id", type = IdType.AUTO)
+  private Long id;
+
+  private Long configKeyId;
+
+  private Long engineTypeLabelId;
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public Long getConfigKeyId() {
+    return configKeyId;
+  }
+
+  public void setConfigKeyId(Long configKeyId) {
+    this.configKeyId = configKeyId;
+  }
+
+  public Long getEngineTypeLabelId() {
+    return engineTypeLabelId;
+  }
+
+  public void setEngineTypeLabelId(Long engineTypeLabelId) {
+    this.engineTypeLabelId = engineTypeLabelId;
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/request/ConfigurationTemplateSaveRequest.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/request/ConfigurationTemplateSaveRequest.java
new file mode 100644
index 000000000..4a82ecf63
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/request/ConfigurationTemplateSaveRequest.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.request;
+
+import java.io.Serializable;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/** A query request for the save a configuration template */
+@ApiModel(
+    value = "configuration template save request",
+    description = "configuration template save request")
+public class ConfigurationTemplateSaveRequest implements Serializable {
+  private static final long serialVersionUID = -5910138059732157333L;
+
+  @ApiModelProperty(value = "key id.")
+  private Long id;
+
+  @ApiModelProperty(value = "engineLabelId.")
+  private String engineLabelId;
+
+  @ApiModelProperty(value = "key. eg: linkis.openlookeng.url")
+  private String key;
+
+  @ApiModelProperty(value = "description. eg: 例如:http://127.0.0.1:8080";)
+  private String description;
+
+  @ApiModelProperty(value = "name. eg: 连接地址")
+  private String name;
+
+  @ApiModelProperty(value = "default value. eg: http://127.0.0.1:8080";)
+  private String defaultValue;
+
+  @ApiModelProperty(value = "validate type. eg: Regex")
+  private String validateType;
+
+  @ApiModelProperty(
+      value = "validate range. eg: 
^\\\\s*http://([^:]+)(:\\\\d+)(/[^\\\\?]+)?(\\\\?\\\\S*)?$")
+  private String validateRange;
+
+  @ApiModelProperty(value = "engine conn type. eg: openlookeng")
+  private String engineConnType;
+
+  @ApiModelProperty(value = "is hidden. eg: 0-否,1-是")
+  private Integer hidden;
+
+  @ApiModelProperty(value = "is advanced. eg: 0-否,1-是")
+  private Integer advanced;
+
+  @ApiModelProperty(value = "level. eg: 1-一级,2-二级")
+  private Integer level;
+
+  @ApiModelProperty(value = "tree name. eg: 数据源配置")
+  private String treeName;
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getEngineLabelId() {
+    return engineLabelId;
+  }
+
+  public void setEngineLabelId(String engineLabelId) {
+    this.engineLabelId = engineLabelId;
+  }
+
+  public String getKey() {
+    return key;
+  }
+
+  public void setKey(String key) {
+    this.key = key;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getDefaultValue() {
+    return defaultValue;
+  }
+
+  public void setDefaultValue(String defaultValue) {
+    this.defaultValue = defaultValue;
+  }
+
+  public String getValidateType() {
+    return validateType;
+  }
+
+  public void setValidateType(String validateType) {
+    this.validateType = validateType;
+  }
+
+  public String getValidateRange() {
+    return validateRange;
+  }
+
+  public void setValidateRange(String validateRange) {
+    this.validateRange = validateRange;
+  }
+
+  public String getEngineConnType() {
+    return engineConnType;
+  }
+
+  public void setEngineConnType(String engineConnType) {
+    this.engineConnType = engineConnType;
+  }
+
+  public Integer getHidden() {
+    return hidden;
+  }
+
+  public void setHidden(Integer hidden) {
+    this.hidden = hidden;
+  }
+
+  public Integer getAdvanced() {
+    return advanced;
+  }
+
+  public void setAdvanced(Integer advanced) {
+    this.advanced = advanced;
+  }
+
+  public Integer getLevel() {
+    return level;
+  }
+
+  public void setLevel(Integer level) {
+    this.level = level;
+  }
+
+  public String getTreeName() {
+    return treeName;
+  }
+
+  public void setTreeName(String treeName) {
+    this.treeName = treeName;
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/response/EngineLabelResponse.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/response/EngineLabelResponse.java
new file mode 100644
index 000000000..856b39d56
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/response/EngineLabelResponse.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.response;
+
+import java.io.Serializable;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/** A response of engine label list query */
+@ApiModel(value = "engine list response", description = "A response of engine 
label list query")
+public class EngineLabelResponse implements Serializable {
+  private static final long serialVersionUID = 8326446645908746848L;
+
+  @ApiModelProperty(value = "label id.")
+  private Integer labelId;
+
+  @ApiModelProperty(value = "engine name. eg: spark-2.4.3")
+  private String engineName;
+
+  public EngineLabelResponse(Integer labelId, String engineName) {
+    this.labelId = labelId;
+    this.engineName = engineName;
+  }
+
+  public Integer getLabelId() {
+    return labelId;
+  }
+
+  public void setLabelId(Integer labelId) {
+    this.labelId = labelId;
+  }
+
+  public String getEngineName() {
+    return engineName;
+  }
+
+  public void setEngineName(String engineName) {
+    this.engineName = engineName;
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/ConfigurationTemplateRestfulApi.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/ConfigurationTemplateRestfulApi.java
new file mode 100644
index 000000000..09c51ea1e
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/restful/ConfigurationTemplateRestfulApi.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.restful;
+
+import org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigKey;
+import 
org.apache.linkis.basedatamanager.server.request.ConfigurationTemplateSaveRequest;
+import org.apache.linkis.basedatamanager.server.response.EngineLabelResponse;
+import 
org.apache.linkis.basedatamanager.server.service.ConfigurationTemplateService;
+import org.apache.linkis.server.Message;
+import org.apache.linkis.server.utils.ModuleUserUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import java.security.InvalidParameterException;
+import java.util.List;
+import java.util.Objects;
+
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+
+/** This module is designed to manage configuration parameter templates */
+@RestController
+@RequestMapping(path = "/basedata-manager/configuration-template")
+public class ConfigurationTemplateRestfulApi {
+
+  @Autowired ConfigurationTemplateService configurationTemplateService;
+
+  @ApiOperation(value = "save", notes = "save a configuration template", 
httpMethod = "POST")
+  @RequestMapping(path = "/save", method = RequestMethod.POST)
+  public Message add(
+      HttpServletRequest httpRequest, @RequestBody 
ConfigurationTemplateSaveRequest request) {
+    ModuleUserUtils.getOperationUser(httpRequest, "save a configuration 
template");
+    if (Objects.isNull(request)
+        || StringUtils.isEmpty(request.getEngineLabelId())
+        || StringUtils.isEmpty(request.getKey())
+        || StringUtils.isEmpty(request.getEngineConnType())
+        || StringUtils.isEmpty(request.getName())
+        || StringUtils.isEmpty(request.getTreeName())) {
+      throw new InvalidParameterException("please check your parameter.");
+    }
+    Boolean flag = 
configurationTemplateService.saveConfigurationTemplate(request);
+    return Message.ok("").data("success: ", flag);
+  }
+
+  @ApiImplicitParams({
+    @ApiImplicitParam(paramType = "path", dataType = "long", name = "keyId", 
value = "")
+  })
+  @ApiOperation(value = "delete", notes = "delete a configuration template", 
httpMethod = "DELETE")
+  @RequestMapping(path = "/{keyId}", method = RequestMethod.DELETE)
+  public Message delete(HttpServletRequest httpRequest, @PathVariable("keyId") 
Long keyId) {
+    ModuleUserUtils.getOperationUser(
+        httpRequest, "delete a configuration template, keyId: " + keyId);
+    Boolean flag = 
configurationTemplateService.deleteConfigurationTemplate(keyId);
+    return Message.ok("").data("success: ", flag);
+  }
+
+  @ApiOperation(value = "engin-list", notes = "get all engine list", 
httpMethod = "GET")
+  @RequestMapping(path = "/engin-list", method = RequestMethod.GET)
+  public Message getEngineList(HttpServletRequest httpRequest) {
+    ModuleUserUtils.getOperationUser(httpRequest, "get all engine list");
+    List<EngineLabelResponse> engineList = 
configurationTemplateService.getEngineList();
+    return Message.ok("").data("success: ", engineList);
+  }
+
+  @ApiOperation(
+      value = "template-list-by-label",
+      notes = "get template list by label",
+      httpMethod = "GET")
+  @RequestMapping(path = "/template-list-by-label", method = RequestMethod.GET)
+  public Message getTemplateListByLabelId(
+      HttpServletRequest httpRequest, @RequestParam String engineLabelId) {
+    ModuleUserUtils.getOperationUser(
+        httpRequest, "get template list by label, engineLabelId: " + 
engineLabelId);
+    if (StringUtils.isEmpty(engineLabelId)) {
+      throw new InvalidParameterException("please check your parameter.");
+    }
+    List<ConfigurationConfigKey> configKeyList =
+        configurationTemplateService.getTemplateListByLabelId(engineLabelId);
+    return Message.ok("").data("success: ", configKeyList);
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/ConfigurationTemplateService.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/ConfigurationTemplateService.java
new file mode 100644
index 000000000..3e1d00a4f
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/ConfigurationTemplateService.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.service;
+
+import org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigKey;
+import 
org.apache.linkis.basedatamanager.server.request.ConfigurationTemplateSaveRequest;
+import org.apache.linkis.basedatamanager.server.response.EngineLabelResponse;
+
+import java.util.List;
+
+/** This module is designed to manage configuration parameter templates */
+public interface ConfigurationTemplateService {
+
+  /**
+   * save a configuration template
+   *
+   * @param request ConfigurationTemplateSaveRequest
+   * @return Boolean
+   */
+  Boolean saveConfigurationTemplate(ConfigurationTemplateSaveRequest request);
+
+  /**
+   * delete a configuration template
+   *
+   * @param keyId Long
+   * @return Boolean
+   */
+  Boolean deleteConfigurationTemplate(Long keyId);
+
+  /**
+   * query all engine list
+   *
+   * @return List
+   */
+  List<EngineLabelResponse> getEngineList();
+
+  /**
+   * query config key list by label id
+   *
+   * @param engineLabelId engine label id
+   * @return List
+   */
+  List<ConfigurationConfigKey> getTemplateListByLabelId(String engineLabelId);
+}
diff --git 
a/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/ConfigurationTemplateServiceImpl.java
 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/ConfigurationTemplateServiceImpl.java
new file mode 100644
index 000000000..73fff43e2
--- /dev/null
+++ 
b/linkis-public-enhancements/linkis-basedata-manager/src/main/java/org/apache/linkis/basedatamanager/server/service/impl/ConfigurationTemplateServiceImpl.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.basedatamanager.server.service.impl;
+
+import org.apache.linkis.basedatamanager.server.dao.CgManagerLabelMapper;
+import 
org.apache.linkis.basedatamanager.server.dao.ConfigurationConfigKeyMapper;
+import 
org.apache.linkis.basedatamanager.server.dao.ConfigurationConfigValueMapper;
+import 
org.apache.linkis.basedatamanager.server.dao.ConfigurationKeyEngineRelationMapper;
+import org.apache.linkis.basedatamanager.server.domain.CgManagerLabel;
+import org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigKey;
+import 
org.apache.linkis.basedatamanager.server.domain.ConfigurationConfigValue;
+import 
org.apache.linkis.basedatamanager.server.domain.ConfigurationKeyEngineRelation;
+import 
org.apache.linkis.basedatamanager.server.request.ConfigurationTemplateSaveRequest;
+import org.apache.linkis.basedatamanager.server.response.EngineLabelResponse;
+import 
org.apache.linkis.basedatamanager.server.service.ConfigurationTemplateService;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.Lists;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** This module is designed to manage configuration parameter templates */
+@Service
+public class ConfigurationTemplateServiceImpl implements 
ConfigurationTemplateService {
+  private static final Logger LOG = 
LoggerFactory.getLogger(ConfigurationTemplateService.class);
+  @Resource ConfigurationConfigKeyMapper configKeyMapper;
+  @Resource ConfigurationKeyEngineRelationMapper relationMapper;
+  @Resource CgManagerLabelMapper managerLabelMapper;
+  @Resource ConfigurationConfigValueMapper configValueMapper;
+
+  @Override
+  @Transactional(rollbackFor = Exception.class)
+  public Boolean saveConfigurationTemplate(ConfigurationTemplateSaveRequest 
request) {
+    // query engine label
+    CgManagerLabel label = 
managerLabelMapper.selectById(request.getEngineLabelId());
+
+    // build key&value
+    ConfigurationConfigKey configKey = new ConfigurationConfigKey();
+    BeanUtils.copyProperties(request, configKey);
+    Long keyId = request.getId();
+    ConfigurationConfigValue configValue = new ConfigurationConfigValue();
+    configValue.setConfigLabelId(label.getId());
+    configValue.setConfigValue(request.getDefaultValue());
+
+    // update
+    if (!StringUtils.isEmpty(keyId)) {
+      LOG.info("update configuration config key: [ keyId: " + keyId + " ]");
+      int updateKey = configKeyMapper.updateById(configKey);
+      configValue.setConfigKeyId(configKey.getId());
+      LOG.info("update configuration config value: [ keyId: " + keyId + " ]");
+      int updateValue = configValueMapper.updateByKeyId(configValue);
+      return updateKey > 0 && updateValue > 0;
+    }
+
+    // 1.insert into ps_configuration_config_key
+    int insertKey = configKeyMapper.insert(configKey);
+    LOG.info("insert a configuration config key: [ keyId: " + 
configKey.getKey() + " ]");
+    // 2.insert into ps_configuration_key_engine_relation
+    ConfigurationKeyEngineRelation relation = new 
ConfigurationKeyEngineRelation();
+    relation.setConfigKeyId(configKey.getId());
+    relation.setEngineTypeLabelId(label.getId().longValue());
+    int insertRelation = relationMapper.insert(relation);
+    LOG.info(
+        "insert a configuration key engine relation: [ relationId: " + 
relation.getId() + " ]");
+    // 3.insert into ps_configuration_config_value
+    configValue.setConfigKeyId(configKey.getId());
+    int insertValue = configValueMapper.insert(configValue);
+    LOG.info("insert a configuration config value: [ valueId: " + 
configValue.getId() + " ]");
+
+    return insertKey > 0 & insertRelation > 0 & insertValue > 0;
+  }
+
+  @Override
+  @Transactional(rollbackFor = Exception.class)
+  public Boolean deleteConfigurationTemplate(Long keyId) {
+    // 1.delete ps_configuration_config_value by keyId
+    int deleteValue = configValueMapper.deleteByKeyId(keyId);
+    LOG.info("delete a configuration config value: [ keyId: " + keyId + " ]");
+
+    // 2.delete ps_configuration_key_engine_relation by keyId
+    int deleteRelation = relationMapper.deleteByKeyId(keyId);
+    LOG.info("delete a configuration key engine relation: [ keyId: " + keyId + 
" ]");
+
+    // 3.delete ps_configuration_config_key by id
+    int deleteKey = configKeyMapper.deleteById(keyId);
+    LOG.info("delete a configuration config key: [ keyId: " + keyId + " ]");
+
+    return deleteValue > 0 & deleteRelation > 0 & deleteKey > 0;
+  }
+
+  @Override
+  public List<EngineLabelResponse> getEngineList() {
+    List<CgManagerLabel> cgEngineList = managerLabelMapper.getEngineList();
+    if (CollectionUtils.isEmpty(cgEngineList)) {
+      return Lists.newArrayList();
+    }
+    return cgEngineList.stream()
+        .map(
+            e -> {
+              String labelValue = e.getLabelValue().split(",")[1];
+              if ("*-*".equals(labelValue)) {
+                labelValue = "全局设置";
+              }
+              return new EngineLabelResponse(e.getId(), labelValue);
+            })
+        .collect(Collectors.toList());
+  }
+
+  @Override
+  public List<ConfigurationConfigKey> getTemplateListByLabelId(String 
engineLabelId) {
+    return configKeyMapper.getTemplateListByLabelId(engineLabelId);
+  }
+}
diff --git 
a/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/CategoryService.scala
 
b/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/CategoryService.scala
index 91a13f3c1..90bf9fc3d 100644
--- 
a/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/CategoryService.scala
+++ 
b/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/CategoryService.scala
@@ -237,6 +237,9 @@ class CategoryService extends Logging {
       )
       if (linkedEngineTypeLabelInDb != null) {
         associateConfigKey(linkedEngineTypeLabelInDb.getId, 
linkedEngineTypeLabel.getStringValue)
+      } else {
+        val engineLabel = 
LabelEntityParser.parseToConfigLabel(linkedEngineTypeLabel)
+        labelMapper.insertLabel(engineLabel)
       }
     }
   }
diff --git 
a/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/ConfigurationService.scala
 
b/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/ConfigurationService.scala
index 269438eca..4884bff6c 100644
--- 
a/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/ConfigurationService.scala
+++ 
b/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/service/ConfigurationService.scala
@@ -46,6 +46,8 @@ import java.util
 
 import scala.collection.JavaConverters._
 
+import com.google.common.collect.Lists
+
 @Service
 class ConfigurationService extends Logging {
 
@@ -385,6 +387,15 @@ class ConfigurationService extends Logging {
     buildTreeResult(configs, defaultEngineConfigs)
   }
 
+  def getConfigurationTemplateByLabelList(
+      labelList: java.util.List[Label[_]],
+      useDefaultConfig: Boolean = true
+  ): util.ArrayList[ConfigTree] = {
+    var (configs, defaultEngineConfigs) = getConfigsByLabelList(labelList, 
useDefaultConfig)
+    configs = Lists.newArrayList()
+    buildTreeResult(configs, defaultEngineConfigs)
+  }
+
   /**
    * Priority: labelList > defaultConfig
    * @param labelList


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to