修改菜单

This commit is contained in:
2025-11-11 11:52:18 +08:00
parent e1d713b23e
commit cc72b1bd64
5 changed files with 43 additions and 0 deletions

View File

@ -107,6 +107,17 @@ public class SysMenuController extends BaseController {
return R.ok(menuService.buildMenuTreeSelect(menus)); 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);
}
/** /**
* 加载对应角色菜单列表树 * 加载对应角色菜单列表树
* *

View File

@ -3,6 +3,7 @@ package org.dromara.system.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import jakarta.validation.constraints.Size;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.dromara.common.core.constant.SystemConstants; import org.dromara.common.core.constant.SystemConstants;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; 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<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
List<SysMenu> selectMenuListByPath(@Param("path") String path);
} }

View File

@ -146,4 +146,6 @@ public interface ISysMenuService {
* @return 结果 * @return 结果
*/ */
boolean checkMenuNameUnique(SysMenuBo menu); boolean checkMenuNameUnique(SysMenuBo menu);
List<RouterVo> getXzdList(SysMenuBo menu);
} }

View File

@ -359,6 +359,13 @@ public class SysMenuServiceImpl implements ISysMenuService {
return !exist; 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获取所有子节点 * 根据父节点的ID获取所有子节点
* *

View File

@ -84,5 +84,26 @@
) )
order by m.parent_id, m.order_num order by m.parent_id, m.order_num
</select> </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> </mapper>