CalvinKirs commented on a change in pull request #4947:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/4947#discussion_r592384748



##########
File path: 
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
##########
@@ -43,32 +43,28 @@
     </select>
     <select id="queryResourceListAuthored" 
resultType="org.apache.dolphinscheduler.dao.entity.Resource">
         select
-        <include refid="baseSql"/>
-        from t_ds_resources
+        <include refid="baseSqlV2">
+            <property name="alias" value="r"/>
+        </include>
+        from t_ds_resources r
         where 1 = 1
         <if test="type != -1">
-            and type=#{type}
-        </if>
-        <if test="userId != 0 and perm != 0">
-            and id in (select resources_id from t_ds_relation_resources_user 
where user_id=#{userId} and perm=#{perm}
-            union select id as resources_id from t_ds_resources where 
user_id=#{userId})
+            and r.type=#{type}
         </if>
-        <if test="userId != 0 and perm == 0">
-            and id in (select resources_id from t_ds_relation_resources_user 
where user_id=#{userId}
-            union select id as resources_id from t_ds_resources where 
user_id=#{userId})
+        <if test="userId != 0">
+            and r.user_id=#{userId}
         </if>
     </select>
     <select id="queryResourcePaging" 
resultType="org.apache.dolphinscheduler.dao.entity.Resource">
         select
         d.id, d.alias, d.file_name, d.description, d.user_id, d.type, d.size, 
d.create_time, d.update_time,
         d.pid, d.full_name, d.is_directory,
         u.user_name as user_name
-        from t_ds_resources d
-        join t_ds_user u on d.user_id = u.id
-        where d.type=#{type} and d.pid=#{id}
+        from t_ds_resources d, t_ds_user u, t_ds_relation_resources_user rel
+        where d.user_id = u.id

Review comment:
       It would be nice to be able to break it down a little bit more




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to