You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "fuweng11 (via GitHub)" <gi...@apache.org> on 2023/09/15 01:49:35 UTC
[GitHub] [inlong] fuweng11 commented on a diff in pull request #8913: [INLONG-8403][Manager] Support resource migrate to another tenant
fuweng11 commented on code in PR #8913:
URL: https://github.com/apache/inlong/pull/8913#discussion_r1326689041
##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/TenantClusterTagEntityMapper.java:
##########
@@ -37,4 +38,6 @@ public interface TenantClusterTagEntityMapper {
List<TenantClusterTagEntity> selectByCondition(TenantClusterTagPageRequest request);
+ int copy(@Param("clusterTag") String clusterTag, @Param("from") String from, @Param("to") String to);
Review Comment:
Ditto.
##########
inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml:
##########
@@ -212,5 +212,55 @@
</if>
</where>
</delete>
-
+ <insert id="copy">
+ insert into data_node (name, display_name, type, url, username,
+ token, ext_params, description, tenant,
+ in_charges, status, creator, modifier)
+ select #{newName, jdbcType=VARCHAR},
+ display_name,
+ type,
+ url,
+ username,
+ token,
+ ext_params,
+ description,
+ #{to, jdbcType=VARCHAR},
+ in_charges,
+ status,
+ creator,
+ modifier
+ from data_node
+ <where>
+ name = #{name, jdbcType=VARCHAR}
+ and type = #{type, jdbcType=VARCHAR}
+ and is_deleted = 0
+ and tenant = #{from, jdbcType=VARCHAR}
+ </where>
+ </insert>
+ <select id="selectByIdSelective"
Review Comment:
Please put the select statement together.
##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongGroupEntityMapper.java:
##########
@@ -115,4 +115,8 @@ int updateStatus(@Param("groupId") String groupId, @Param("status") Integer stat
@MultiTenantQuery(with = false)
List<InlongGroupEntity> selectAllGroupsByTenant(@Param(value = "tenant") String tenant);
+ @MultiTenantQuery(with = false)
+ int migrate(@Param(value = "groupId") String groupId, @Param(value = "from") String from,
Review Comment:
@Param(value = "sourceTenant")
@Param(value = "targetTenant")
##########
inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml:
##########
@@ -212,5 +212,55 @@
</if>
</where>
</delete>
-
+ <insert id="copy">
+ insert into data_node (name, display_name, type, url, username,
+ token, ext_params, description, tenant,
+ in_charges, status, creator, modifier)
+ select #{newName, jdbcType=VARCHAR},
+ display_name,
+ type,
+ url,
+ username,
+ token,
+ ext_params,
+ description,
+ #{to, jdbcType=VARCHAR},
+ in_charges,
+ status,
+ creator,
+ modifier
+ from data_node
+ <where>
+ name = #{name, jdbcType=VARCHAR}
+ and type = #{type, jdbcType=VARCHAR}
+ and is_deleted = 0
+ and tenant = #{from, jdbcType=VARCHAR}
+ </where>
+ </insert>
+ <select id="selectByIdSelective"
+ parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity"
+ resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from data_node
+ <where>
+ <if test="type != null">
Review Comment:
`<if test="type != null and type != ''">`
##########
inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml:
##########
@@ -562,5 +562,13 @@
and is_deleted = 0
</where>
</select>
-
+ <update id="migrate">
Review Comment:
Ditto.
##########
inlong-manager/manager-dao/src/main/resources/mappers/DataNodeEntityMapper.xml:
##########
@@ -212,5 +212,55 @@
</if>
</where>
</delete>
-
+ <insert id="copy">
+ insert into data_node (name, display_name, type, url, username,
+ token, ext_params, description, tenant,
+ in_charges, status, creator, modifier)
+ select #{newName, jdbcType=VARCHAR},
+ display_name,
+ type,
+ url,
+ username,
+ token,
+ ext_params,
+ description,
+ #{to, jdbcType=VARCHAR},
+ in_charges,
+ status,
+ creator,
+ modifier
+ from data_node
+ <where>
+ name = #{name, jdbcType=VARCHAR}
+ and type = #{type, jdbcType=VARCHAR}
+ and is_deleted = 0
+ and tenant = #{from, jdbcType=VARCHAR}
+ </where>
+ </insert>
+ <select id="selectByIdSelective"
+ parameterType="org.apache.inlong.manager.dao.entity.DataNodeEntity"
+ resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from data_node
+ <where>
+ <if test="type != null">
+ and type = #{type, jdbcType=VARCHAR}
+ </if>
+ <if test="url != null">
Review Comment:
Ditto.
##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/DataNodeEntityMapper.java:
##########
@@ -51,4 +51,11 @@ public interface DataNodeEntityMapper {
int deleteById(Integer id);
+ @MultiTenantQuery(with = false)
+ int copy(@Param("name") String name, @Param("type") String type, @Param("from") String from, @Param("to") String to,
Review Comment:
@param(value = "sourceTenant")
@param(value = "targetTenant")
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org