update 优化 大数据量下join卡顿问题 使用子查询提高性能

This commit is contained in:
疯狂的狮子Li
2024-06-28 12:49:58 +08:00
parent 3dff529920
commit a4fe077a23
5 changed files with 13 additions and 37 deletions
@@ -48,9 +48,7 @@
r.data_scope,
r.status
from sys_role r
left join sys_user_role sur on sur.role_id = r.role_id
left join sys_user u on u.user_id = sur.user_id
WHERE r.del_flag = '0' and sur.user_id = #{userId}
WHERE r.del_flag = '0' and r.role_id in (select role_id from sys_user_role where user_id = #{userId})
</select>
<select id="selectRoleById" resultMap="SysRoleResult">