You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/12/25 06:06:11 UTC

[GitHub] [dolphinscheduler] linyanbin666 commented on a change in pull request #7026: [Improvement-6725][API+UI]: Support to change the owner of project/datasource/resource/udfFunc

linyanbin666 commented on a change in pull request #7026:
URL: https://github.com/apache/dolphinscheduler/pull/7026#discussion_r775111480



##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java
##########
@@ -443,4 +447,62 @@ private String getHiddenPassword() {
         return result;
     }
 
+    /**
+     * query datasource list created by user
+     *
+     * @param userId user id
+     * @return datasource list
+     */
+    @Override
+    public List<DataSource> queryCreatedByUser(int userId) {
+        return dataSourceMapper.selectList(Wrappers.<DataSource>lambdaQuery().eq(DataSource::getUserId, userId));
+    }
+
+    /**
+     * transfer datasource list owned by the user
+     *
+     * @param transferredUserId transferred user id
+     * @param receivedUserId received user id
+     * @param transferredIds transferred ids
+     * @return transfer result code
+     */
+    @Override
+    public Map<String, Object> transferOwnedData(int transferredUserId, int receivedUserId, List<Integer> transferredIds) {
+        Map<String, Object> result = new HashMap<>();
+
+        List<DataSource> dataSources = dataSourceMapper.selectList(Wrappers.<DataSource>lambdaQuery()
+                .eq(DataSource::getUserId, transferredUserId)
+                .in(DataSource::getId, transferredIds)
+        );
+        Set<Integer> realDataSourceIds = dataSources.stream().map(DataSource::getId).collect(Collectors.toSet());
+        // update datasource owner
+        int updatedDatasourceNum = dataSourceMapper.update(null, Wrappers.<DataSource>lambdaUpdate()

Review comment:
       Yes, it has been modified.




-- 
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@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org