You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by GitBox <gi...@apache.org> on 2022/10/14 13:10:44 UTC

[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1828: [Feature] Improve the search_owner when query the app list

wolfboys commented on code in PR #1828:
URL: https://github.com/apache/incubator-streampark/pull/1828#discussion_r995743910


##########
streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml:
##########
@@ -59,4 +59,34 @@
             order by ${user.sortField} ${user.sortOrder}
         </if>
     </select>
+
+    <select id="getNoTokenUser" resultType="user" parameterType="user">
+        select u.* from t_user u left join t_access_token t
+        on u.user_id = t.user_id
+        where t.user_id is null
+    </select>
+
+    <select id="findByAppOwner" resultType="user" parameterType="user">
+        select u.* from t_user u
+        inner join (
+            select distinct(user_id) as user_id from (
+                select a.user_id
+                    from t_user a
+                    inner join t_flink_app b
+                    on a.user_id = b.user_id
+                    where a.user_id = #{userId}
+                    and a.user_type = 1
+                union all
+                select u.user_id
+                    from t_user u
+                    inner join t_member m
+                    on u.user_id = m.user_id
+                    inner join t_flink_app p
+                    on u.user_id = p.user_id
+                    where m.team_id = #{teamId}
+            )
+        ) as t
+        where u.user_id = t.user_id

Review Comment:
   > Why don't use this sql?
   > 
   > ```
   > select u.* from t_user u 
   > inner join (
   > select distinct(user_id) from t_flink_app where m.team_id = #{teamId}
   > ) t
   > where u.user_id = t.user_id
   > ```
   > 
   > The new sql has some advantages:
   > 
   > * It is more simple.
   > * It is easy to understand for other developers.
   > * And it can show all apps owner for current team.
   > * When some team members leave or move to other teams, we should also be able to filter his apps.
   > * For the System Admin team, Admins often have some test jobs. AdminA should be able to filter AdminB's apps.
   > 
   > The new sql is simple and feature rich, why use a complex sql?
   
   oh, Perfect 👍 😂



-- 
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: issues-unsubscribe@streampark.apache.org

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