You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by he...@apache.org on 2022/02/28 12:26:35 UTC

[incubator-inlong] branch master updated: [INLONG-2693][Manager] Define tables and beans for getSortSource interface (#2709)

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

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new a111235  [INLONG-2693][Manager] Define tables and beans for getSortSource interface (#2709)
a111235 is described below

commit a111235484a2fc1e9edd5a8a989ebff0101abe19
Author: imvan <de...@pku.edu.cn>
AuthorDate: Mon Feb 28 20:26:28 2022 +0800

    [INLONG-2693][Manager] Define tables and beans for getSortSource interface (#2709)
---
 .../common/pojo/sort/SortSourceConfigResponse.java |  2 +-
 .../manager/dao/entity/SortSourceConfigEntity.java | 34 +++++++++
 .../dao/mapper/SortSourceConfigEntityMapper.java   | 35 ++++++++++
 .../src/main/resources/generatorConfig.xml         | 10 ++-
 .../mappers/SortSourceConfigEntityMapper.xml       | 81 ++++++++++++++++++++++
 .../manager-web/sql/apache_inlong_manager.sql      | 19 ++++-
 .../web/controller/openapi/SortController.java     |  2 +-
 7 files changed, 179 insertions(+), 4 deletions(-)

diff --git a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sort/SortSourceConfigResponse.java b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sort/SortSourceConfigResponse.java
index faff9f3..a13f45c 100644
--- a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sort/SortSourceConfigResponse.java
+++ b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sort/SortSourceConfigResponse.java
@@ -37,7 +37,7 @@ public class SortSourceConfigResponse {
     @Builder
     public static class SortSourceConfig {
         String sortClusterName;
-        String sortId;
+        String zoneName;
         Map<String, CacheZone> cacheZones;
     }
 
diff --git a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/SortSourceConfigEntity.java b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/SortSourceConfigEntity.java
new file mode 100644
index 0000000..eca7fc4
--- /dev/null
+++ b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/SortSourceConfigEntity.java
@@ -0,0 +1,34 @@
+/*
+ * 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.inlong.manager.dao.entity;
+
+import lombok.Builder;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@Builder
+public class SortSourceConfigEntity implements Serializable {
+    private Integer id;
+    private String clusterName;
+    private String taskName;
+    private String zoneName;
+    private String topic;
+    private String extParams;
+}
\ No newline at end of file
diff --git a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/SortSourceConfigEntityMapper.java b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/SortSourceConfigEntityMapper.java
new file mode 100644
index 0000000..30398f9
--- /dev/null
+++ b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/SortSourceConfigEntityMapper.java
@@ -0,0 +1,35 @@
+/*
+ * 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.inlong.manager.dao.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.apache.inlong.manager.dao.entity.SortSourceConfigEntity;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface SortSourceConfigEntityMapper {
+    int insert(SortSourceConfigEntity record);
+
+    int insertSelective(SortSourceConfigEntity record);
+
+    List<SortSourceConfigEntity> selectByClusterAndTask(
+            @Param("clusterName") String clusterName,
+            @Param("taskName") String taskName);
+}
\ No newline at end of file
diff --git a/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml b/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
index 1c2e007..a310ca1 100644
--- a/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
+++ b/inlong-manager/manager-dao/src/main/resources/generatorConfig.xml
@@ -259,7 +259,15 @@
             enableUpdateByPrimaryKey="true"
             enableDeleteByPrimaryKey="true" enableInsert="true"
             enableCountByExample="false" enableDeleteByExample="false"
-            enableSelectByExample="false" enableUpdateByExample="false"/>-->
+            enableSelectByExample="false" enableUpdateByExample="false"/>
+
+        <table tableName="sort_source_config" domainObjectName="SortSourceConfigEntity"
+               enableSelectByPrimaryKey="false"
+               enableUpdateByPrimaryKey="false"
+               enableDeleteByPrimaryKey="false" enableInsert="true"
+               enableCountByExample="false" enableDeleteByExample="false"
+               enableSelectByExample="false" enableUpdateByExample="false"/>-->
+
 
     </context>
 </generatorConfiguration>
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/SortSourceConfigEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/SortSourceConfigEntityMapper.xml
new file mode 100644
index 0000000..1cccf90
--- /dev/null
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/SortSourceConfigEntityMapper.xml
@@ -0,0 +1,81 @@
+<?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.inlong.manager.dao.mapper.SortSourceConfigEntityMapper">
+  <insert id="insert" parameterType="org.apache.inlong.manager.dao.entity.SortSourceConfigEntity">
+    insert into sort_source_config (id, cluster_name, task_name, 
+      zone_name, topic, ext_params
+      )
+    values (#{id,jdbcType=INTEGER}, #{clusterName,jdbcType=VARCHAR}, #{taskName,jdbcType=VARCHAR}, 
+      #{zoneName,jdbcType=VARCHAR}, #{topic,jdbcType=VARCHAR}, #{extParams,jdbcType=LONGVARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="org.apache.inlong.manager.dao.entity.SortSourceConfigEntity">
+    insert into sort_source_config
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="clusterName != null">
+        cluster_name,
+      </if>
+      <if test="taskName != null">
+        task_name,
+      </if>
+      <if test="zoneName != null">
+        zone_name,
+      </if>
+      <if test="topic != null">
+        topic,
+      </if>
+      <if test="extParams != null">
+        ext_params,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="clusterName != null">
+        #{clusterName,jdbcType=VARCHAR},
+      </if>
+      <if test="taskName != null">
+        #{taskName,jdbcType=VARCHAR},
+      </if>
+      <if test="zoneName != null">
+        #{zoneName,jdbcType=VARCHAR},
+      </if>
+      <if test="topic != null">
+        #{topic,jdbcType=VARCHAR},
+      </if>
+      <if test="extParams != null">
+        #{extParams,jdbcType=LONGVARCHAR},
+      </if>
+    </trim>
+  </insert>
+
+  <select id="selectByClusterAndTask" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from sort_source_config
+    where cluster_name = #{clusterName,jdbcType=INTEGER}
+    AND task_name = #{taskName,jdbcType=VARCHAR}
+  </select>
+</mapper>
\ No newline at end of file
diff --git a/inlong-manager/manager-web/sql/apache_inlong_manager.sql b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
index 8617752..0a46a13 100644
--- a/inlong-manager/manager-web/sql/apache_inlong_manager.sql
+++ b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
@@ -1124,6 +1124,23 @@ CREATE TABLE `sort_task_sink_param`
   DEFAULT CHARSET = utf8mb4 COMMENT ='Sort task sink params table';
 
 -- ----------------------------
+-- Table structure for sort_source_config
+-- ----------------------------
+DROP TABLE IF EXISTS `sort_source_config`;
+CREATE TABLE `sort_source_config`
+(
+    `id`            int(11)       NOT NULL AUTO_INCREMENT COMMENT 'Incremental primary key',
+    `cluster_name`  varchar(128)  NOT NULL COMMENT 'Cluster name',
+    `task_name`     varchar(128)  NOT NULL COMMENT 'Task name',
+    `zone_name`     varchar(128)  NOT NULL COMMENT 'Cache zone name',
+    `topic`         varchar(128)  DEFAULT NULL COMMENT 'Topic',
+    `ext_params`    text          DEFAULT NULL COMMENT 'Another fields, will saved as JSON type',
+    PRIMARY KEY (`id`),
+    KEY `index_sort_source_config` (`cluster_name`, `task_name`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4 COMMENT ='Sort source config table';
+
+-- ----------------------------
 -- Table structure for config log report
 -- ----------------------------
 DROP TABLE IF EXISTS `stream_config_log`;
@@ -1167,4 +1184,4 @@ CREATE TABLE `stream_metric`
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8 COMMENT ='stream metric report information table';
 
-SET FOREIGN_KEY_CHECKS = 1;
\ No newline at end of file
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/SortController.java b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/SortController.java
index 2d6f4d6..054c98a 100644
--- a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/SortController.java
+++ b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/SortController.java
@@ -45,7 +45,7 @@ public class SortController {
     }
 
     @GetMapping("/getSortSource")
-    @ApiOperation(value = "get sort sdk cnfig")
+    @ApiOperation(value = "get sort sdk config")
     public SortSourceConfigResponse getSortSourceConfig(
             @RequestParam String clusterName,
             @RequestParam String sortTaskId,