mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 优化 大数据量下join卡顿问题 使用子查询提高性能
This commit is contained in:
@ -11,9 +11,8 @@
|
||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.query_param, m.visible, m.status,
|
||||
m.perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
left join sys_role ro on sur.role_id = ro.role_id
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_role r on sur.role_id = r.role_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
@ -34,14 +33,10 @@
|
||||
m.order_num,
|
||||
m.create_time
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
left join sys_role ro on sur.role_id = ro.role_id
|
||||
left join sys_user u on sur.user_id = u.user_id
|
||||
where u.user_id = #{userId}
|
||||
and m.menu_type in ('M', 'C')
|
||||
and m.status = '0'
|
||||
and ro.status = '0'
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id and m.status = '0'
|
||||
left join sys_role r on rm.role_id = r.role_id and r.status = '0'
|
||||
where m.menu_type in ('M', 'C')
|
||||
and r.role_id in (select role_id from sys_user_role where user_id = #{userId})
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
@ -57,22 +52,12 @@
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPerms" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
left join sys_role r on r.role_id = sur.role_id
|
||||
where m.status = '0'
|
||||
and r.status = '0'
|
||||
and sur.user_id = #{userId}
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id and m.status = '0'
|
||||
left join sys_role r on r.role_id = rm.role_id and r.status = '0'
|
||||
where r.role_id in (select role_id from sys_user_role where user_id = #{userId})
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
||||
|
@ -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">
|
||||
|
Reference in New Issue
Block a user