修改菜单
This commit is contained in:
@ -107,6 +107,17 @@ public class SysMenuController extends BaseController {
|
||||
return R.ok(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
// @SaCheckPermission("system:menu:getXzdList")
|
||||
@GetMapping("/getXzdList")
|
||||
public R<List<RouterVo>> getXzdList(SysMenuBo menu) {
|
||||
List<RouterVo> menus = menuService.getXzdList(menu);
|
||||
return R.ok(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*
|
||||
|
||||
@ -3,6 +3,7 @@ package org.dromara.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@ -74,4 +75,5 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
*/
|
||||
List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||
|
||||
List<SysMenu> selectMenuListByPath(@Param("path") String path);
|
||||
}
|
||||
|
||||
@ -146,4 +146,6 @@ public interface ISysMenuService {
|
||||
* @return 结果
|
||||
*/
|
||||
boolean checkMenuNameUnique(SysMenuBo menu);
|
||||
|
||||
List<RouterVo> getXzdList(SysMenuBo menu);
|
||||
}
|
||||
|
||||
@ -359,6 +359,13 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
return !exist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RouterVo> getXzdList(SysMenuBo menu) {
|
||||
List<SysMenu> sysMenus = baseMapper.selectMenuListByPath(menu.getPath());
|
||||
List<SysMenu> menus = getChildPerms(sysMenus, 0);
|
||||
return buildMenus(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父节点的ID获取所有子节点
|
||||
*
|
||||
|
||||
@ -84,5 +84,26 @@
|
||||
)
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
<select id="selectMenuListByPath" resultType="org.dromara.system.domain.SysMenu">
|
||||
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,
|
||||
m.menu_source
|
||||
from sys_menu m
|
||||
where m.path = #{path} or m.parent_id = (select menu_id from sys_menu where path = #{path})
|
||||
order by m.order_num
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user