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/06/27 03:11:40 UTC

[inlong] branch master updated: [INLONG-4781][Manager] Refactor the InlongStreamExtEntityMapper file (#4782)

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/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new e3aa41320 [INLONG-4781][Manager] Refactor the InlongStreamExtEntityMapper file (#4782)
e3aa41320 is described below

commit e3aa413203aa51eed8989f8a5bc3c21c3d462a7c
Author: ciscozhou <45...@users.noreply.github.com>
AuthorDate: Mon Jun 27 11:11:34 2022 +0800

    [INLONG-4781][Manager] Refactor the InlongStreamExtEntityMapper file (#4782)
---
 .../dao/mapper/InlongStreamExtEntityMapper.java    |  33 +--
 .../mappers/ConsumptionPulsarEntityMapper.xml      |   2 +-
 .../mappers/InlongGroupExtEntityMapper.xml         |   2 +-
 .../resources/mappers/InlongStreamEntityMapper.xml |   3 +-
 .../mappers/InlongStreamExtEntityMapper.xml        | 274 +++++++--------------
 .../mappers/InlongStreamFieldEntityMapper.xml      |   2 +-
 .../mappers/StreamSinkExtEntityMapper.xml          |   2 +-
 7 files changed, 112 insertions(+), 206 deletions(-)

diff --git a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongStreamExtEntityMapper.java b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongStreamExtEntityMapper.java
index 68ef19457..94b65419e 100644
--- a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongStreamExtEntityMapper.java
+++ b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongStreamExtEntityMapper.java
@@ -26,22 +26,8 @@ import java.util.List;
 @Repository
 public interface InlongStreamExtEntityMapper {
 
-    int deleteByPrimaryKey(Integer id);
-
     int insert(InlongStreamExtEntity record);
 
-    int insertSelective(InlongStreamExtEntity record);
-
-    InlongStreamExtEntity selectByPrimaryKey(Integer id);
-
-    int updateByPrimaryKeySelective(InlongStreamExtEntity record);
-
-    int updateByPrimaryKeyWithBLOBs(InlongStreamExtEntity record);
-
-    int updateByPrimaryKey(InlongStreamExtEntity record);
-
-    List<InlongStreamExtEntity> selectByRelatedId(@Param("groupId") String groupId, @Param("streamId") String streamId);
-
     /**
      * Insert data in batches
      *
@@ -56,12 +42,9 @@ public interface InlongStreamExtEntityMapper {
      */
     int insertOnDuplicateKeyUpdate(@Param("extList") List<InlongStreamExtEntity> extList);
 
-    /**
-     * Physically delete all extension fields based on group id and stream id
-     *
-     * @return rows deleted
-     */
-    int deleteAllByRelatedId(@Param("groupId") String groupId, @Param("streamId") String streamId);
+    List<InlongStreamExtEntity> selectByRelatedId(@Param("groupId") String groupId, @Param("streamId") String streamId);
+
+    int updateByPrimaryKey(InlongStreamExtEntity record);
 
     /**
      * Logically delete all extended fields based on group id and stream id
@@ -69,4 +52,14 @@ public interface InlongStreamExtEntityMapper {
      * @return rows updated
      */
     int logicDeleteAllByRelatedId(@Param("groupId") String groupId, @Param("streamId") String streamId);
+
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * Physically delete all extension fields based on group id and stream id
+     *
+     * @return rows deleted
+     */
+    int deleteAllByRelatedId(@Param("groupId") String groupId, @Param("streamId") String streamId);
+
 }
\ No newline at end of file
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/ConsumptionPulsarEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/ConsumptionPulsarEntityMapper.xml
index badd33806..f5eb73453 100644
--- a/inlong-manager/manager-dao/src/main/resources/mappers/ConsumptionPulsarEntityMapper.xml
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/ConsumptionPulsarEntityMapper.xml
@@ -51,7 +51,7 @@
 
     <delete id="deleteByConsumptionId">
         update consumption_pulsar
-        set is_deleted = 1
+        set is_deleted = id
         where consumption_id = #{consumptionId, jdbcType=INTEGER}
           and is_deleted = 0
     </delete>
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupExtEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupExtEntityMapper.xml
index 094991931..4ac134c6f 100644
--- a/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupExtEntityMapper.xml
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupExtEntityMapper.xml
@@ -146,7 +146,7 @@
     </update>
     <update id="logicDeleteAllByGroupId">
         update inlong_group_ext
-        set is_deleted = 1
+        set is_deleted = id
         where inlong_group_id = #{groupId, jdbcType=VARCHAR}
           and is_deleted = 0
     </update>
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamEntityMapper.xml
index ab54f4f11..e6f992473 100644
--- a/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamEntityMapper.xml
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamEntityMapper.xml
@@ -56,7 +56,6 @@
         status, previous_status, is_deleted, creator, modifier, create_time, modify_time
     </sql>
 
-
     <insert id="insert" useGeneratedKeys="true" keyProperty="id"
             parameterType="org.apache.inlong.manager.dao.entity.InlongStreamEntity">
         insert into inlong_stream (id, inlong_group_id, inlong_stream_id,
@@ -422,7 +421,7 @@
     </update>
     <update id="logicDeleteDlqOrRlq">
         update inlong_stream
-        set is_deleted = 1,
+        set is_deleted = id,
             modifier   = #{operator, jdbcType=VARCHAR}
         where inlong_group_id = #{groupId, jdbcType=VARCHAR}
           and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamExtEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamExtEntityMapper.xml
index cb20be255..efa7c726e 100644
--- a/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamExtEntityMapper.xml
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamExtEntityMapper.xml
@@ -20,184 +20,98 @@
 
 <!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.InlongStreamExtEntityMapper">
-  <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId" />
-    <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId" />
-    <result column="key_name" jdbcType="VARCHAR" property="keyName" />
-    <result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
-    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
-  </resultMap>
-  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    <result column="key_value" jdbcType="LONGVARCHAR" property="keyValue" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    id, inlong_group_id, inlong_stream_id, key_name, is_deleted, modify_time
-  </sql>
-  <sql id="Blob_Column_List">
-    key_value
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
-    select 
-    <include refid="Base_Column_List" />
-    ,
-    <include refid="Blob_Column_List" />
-    from inlong_stream_ext
-    where id = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    delete from inlong_stream_ext
-    where id = #{id,jdbcType=INTEGER}
-  </delete>
-  <insert id="insert" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    insert into inlong_stream_ext (id, inlong_group_id, inlong_stream_id, 
-      key_name, is_deleted, modify_time, 
-      key_value)
-    values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR}, #{inlongStreamId,jdbcType=VARCHAR}, 
-      #{keyName,jdbcType=VARCHAR}, #{isDeleted,jdbcType=INTEGER}, #{modifyTime,jdbcType=TIMESTAMP}, 
-      #{keyValue,jdbcType=LONGVARCHAR})
-  </insert>
-  <insert id="insertSelective" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    insert into inlong_stream_ext
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="inlongGroupId != null">
-        inlong_group_id,
-      </if>
-      <if test="inlongStreamId != null">
-        inlong_stream_id,
-      </if>
-      <if test="keyName != null">
-        key_name,
-      </if>
-      <if test="isDeleted != null">
-        is_deleted,
-      </if>
-      <if test="modifyTime != null">
-        modify_time,
-      </if>
-      <if test="keyValue != null">
-        key_value,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=INTEGER},
-      </if>
-      <if test="inlongGroupId != null">
-        #{inlongGroupId,jdbcType=VARCHAR},
-      </if>
-      <if test="inlongStreamId != null">
-        #{inlongStreamId,jdbcType=VARCHAR},
-      </if>
-      <if test="keyName != null">
-        #{keyName,jdbcType=VARCHAR},
-      </if>
-      <if test="isDeleted != null">
-        #{isDeleted,jdbcType=INTEGER},
-      </if>
-      <if test="modifyTime != null">
-        #{modifyTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="keyValue != null">
-        #{keyValue,jdbcType=LONGVARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    update inlong_stream_ext
-    <set>
-      <if test="inlongGroupId != null">
-        inlong_group_id = #{inlongGroupId,jdbcType=VARCHAR},
-      </if>
-      <if test="inlongStreamId != null">
-        inlong_stream_id = #{inlongStreamId,jdbcType=VARCHAR},
-      </if>
-      <if test="keyName != null">
-        key_name = #{keyName,jdbcType=VARCHAR},
-      </if>
-      <if test="isDeleted != null">
-        is_deleted = #{isDeleted,jdbcType=INTEGER},
-      </if>
-      <if test="modifyTime != null">
-        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="keyValue != null">
-        key_value = #{keyValue,jdbcType=LONGVARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKeyWithBLOBs" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    update inlong_stream_ext
-    set inlong_group_id = #{inlongGroupId,jdbcType=VARCHAR},
-      inlong_stream_id = #{inlongStreamId,jdbcType=VARCHAR},
-      key_name = #{keyName,jdbcType=VARCHAR},
-      is_deleted = #{isDeleted,jdbcType=INTEGER},
-      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
-      key_value = #{keyValue,jdbcType=LONGVARCHAR}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    update inlong_stream_ext
-    set inlong_group_id = #{inlongGroupId,jdbcType=VARCHAR},
-      inlong_stream_id = #{inlongStreamId,jdbcType=VARCHAR},
-      key_name = #{keyName,jdbcType=VARCHAR},
-      is_deleted = #{isDeleted,jdbcType=INTEGER},
-      modify_time = #{modifyTime,jdbcType=TIMESTAMP}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <select id="selectByRelatedId" resultType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
-    select
-    <include refid="Base_Column_List"/>
-    from inlong_stream_ext
-    where inlong_group_id = #{groupId, jdbcType=VARCHAR}
-    <if test="streamId != null and streamId != ''">
-      and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
-    </if>
-    and is_deleted = 0
-  </select>
-  <!-- Bulk insert-->
-  <insert id="insertAll" parameterType="java.util.List">
-    insert into inlong_stream_ext
-    (id, inlong_group_id, inlong_stream_id, key_name, key_value, is_deleted)
-    values
-    <foreach collection="extList" separator="," index="index" item="item">
-      (#{item.id}, #{item.inlongGroupId}, #{item.inlongStreamId}, #{item.keyName}, #{item.keyValue}, #{item.isDeleted})
-    </foreach>
-  </insert>
-  <!-- Bulk insert,update if exists-->
-  <insert id="insertOnDuplicateKeyUpdate" parameterType="java.util.List">
-    insert into inlong_stream_ext
-    (id, inlong_group_id, inlong_stream_id, key_name, key_value, is_deleted)
-    values
-    <foreach collection="extList" separator="," index="index" item="item">
-      (#{item.id}, #{item.inlongGroupId}, #{item.inlongStreamId}, #{item.keyName}, #{item.keyValue}, #{item.isDeleted})
-    </foreach>
-    ON DUPLICATE KEY UPDATE
-    inlong_group_id = VALUES(inlong_group_id),
-    inlong_stream_id = VALUES(inlong_stream_id),
-    key_name = VALUES(key_name),
-    key_value = VALUES(key_value),
-    is_deleted = VALUES(is_deleted)
-  </insert>
-  <delete id="deleteAllByRelatedId">
-    delete
-    from inlong_stream_ext
-    where inlong_group_id = #{groupId, jdbcType=VARCHAR}
-    <if test="streamId != null and streamId != ''">
-      and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
-    </if>
-  </delete>
-  <update id="logicDeleteAllByRelatedId">
-    update inlong_stream_ext
-    set is_deleted = 1
-    where is_deleted = 0
-    and inlong_group_id = #{groupId, jdbcType=VARCHAR}
-    <if test="streamId != null and streamId != ''">
-      and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
-    </if>
-  </update>
+    <resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
+        <id column="id" jdbcType="INTEGER" property="id"/>
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="key_name" jdbcType="VARCHAR" property="keyName"/>
+        <result column="key_value" jdbcType="LONGVARCHAR" property="keyValue"/>
+        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
+        <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id, inlong_group_id, inlong_stream_id, key_name, key_value, is_deleted, modify_time
+    </sql>
+
+    <insert id="insert" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
+        insert into inlong_stream_ext (id, inlong_group_id, inlong_stream_id,
+                                       key_name, is_deleted, modify_time,
+                                       key_value)
+        values (#{id,jdbcType=INTEGER}, #{inlongGroupId,jdbcType=VARCHAR}, #{inlongStreamId,jdbcType=VARCHAR},
+                #{keyName,jdbcType=VARCHAR}, #{isDeleted,jdbcType=INTEGER}, #{modifyTime,jdbcType=TIMESTAMP},
+                #{keyValue,jdbcType=LONGVARCHAR})
+    </insert>
+    <!-- Bulk insert-->
+    <insert id="insertAll" parameterType="java.util.List">
+        insert into inlong_stream_ext
+        (id, inlong_group_id, inlong_stream_id, key_name, key_value, is_deleted)
+        values
+        <foreach collection="extList" separator="," index="index" item="item">
+            (#{item.id}, #{item.inlongGroupId}, #{item.inlongStreamId}, #{item.keyName}, #{item.keyValue},
+            #{item.isDeleted})
+        </foreach>
+    </insert>
+    <!-- Bulk insert, update if exists-->
+    <insert id="insertOnDuplicateKeyUpdate" parameterType="java.util.List">
+        insert into inlong_stream_ext
+        (id, inlong_group_id, inlong_stream_id, key_name, key_value, is_deleted)
+        values
+        <foreach collection="extList" separator="," index="index" item="item">
+            (#{item.id}, #{item.inlongGroupId}, #{item.inlongStreamId},
+            #{item.keyName}, #{item.keyValue}, #{item.isDeleted})
+        </foreach>
+        ON DUPLICATE KEY UPDATE
+        inlong_group_id = VALUES(inlong_group_id),
+        inlong_stream_id = VALUES(inlong_stream_id),
+        key_name = VALUES(key_name),
+        key_value = VALUES(key_value),
+        is_deleted = VALUES(is_deleted)
+    </insert>
+
+    <select id="selectByRelatedId" resultType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
+        select
+        <include refid="Base_Column_List"/>
+        from inlong_stream_ext
+        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
+        <if test="streamId != null and streamId != ''">
+            and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
+        </if>
+        and is_deleted = 0
+    </select>
+
+    <update id="updateByPrimaryKey" parameterType="org.apache.inlong.manager.dao.entity.InlongStreamExtEntity">
+        update inlong_stream_ext
+        set inlong_group_id  = #{inlongGroupId,jdbcType=VARCHAR},
+            inlong_stream_id = #{inlongStreamId,jdbcType=VARCHAR},
+            key_name         = #{keyName,jdbcType=VARCHAR},
+            is_deleted       = #{isDeleted,jdbcType=INTEGER},
+            modify_time      = #{modifyTime,jdbcType=TIMESTAMP},
+            key_value        = #{keyValue,jdbcType=LONGVARCHAR}
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+    <update id="logicDeleteAllByRelatedId">
+        update inlong_stream_ext
+        set is_deleted = id
+        where is_deleted = 0
+        and inlong_group_id = #{groupId, jdbcType=VARCHAR}
+        <if test="streamId != null and streamId != ''">
+            and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
+        </if>
+    </update>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete
+        from inlong_stream_ext
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <delete id="deleteAllByRelatedId">
+        delete
+        from inlong_stream_ext
+        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
+        <if test="streamId != null and streamId != ''">
+            and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
+        </if>
+    </delete>
+
 </mapper>
\ No newline at end of file
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamFieldEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamFieldEntityMapper.xml
index 89abb39dc..75f389ee0 100644
--- a/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamFieldEntityMapper.xml
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/InlongStreamFieldEntityMapper.xml
@@ -107,7 +107,7 @@
 
     <update id="logicDeleteAllByIdentifier">
         update inlong_stream_field
-        set is_deleted = 1
+        set is_deleted = id
         where inlong_group_id = #{groupId, jdbcType=VARCHAR}
           and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
           and is_deleted = 0
diff --git a/inlong-manager/manager-dao/src/main/resources/mappers/StreamSinkExtEntityMapper.xml b/inlong-manager/manager-dao/src/main/resources/mappers/StreamSinkExtEntityMapper.xml
index a2bc0f96e..2e13c7a3f 100644
--- a/inlong-manager/manager-dao/src/main/resources/mappers/StreamSinkExtEntityMapper.xml
+++ b/inlong-manager/manager-dao/src/main/resources/mappers/StreamSinkExtEntityMapper.xml
@@ -149,7 +149,7 @@
     </update>
     <update id="logicDeleteAll">
         update stream_sink_ext
-        set is_deleted = 1
+        set is_deleted = id
         where sink_id = #{sinkId, jdbcType=INTEGER}
           and is_deleted = 0
     </update>