diff --git a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuFactory.java b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuFactory.java index a84c0cd19..4315c0d00 100644 --- a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuFactory.java +++ b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuFactory.java @@ -83,13 +83,27 @@ public class MenuFactory { // 将菜单信息转化为响应类型 List appMenuItems = new ArrayList<>(); for (SysMenu appMenu : appMenus) { - MenuItemDetail menuItemDetail = new MenuItemDetail(appMenu.getMenuId(), appMenu.getMenuParentId(), appMenu.getMenuName(), appMenu.getMenuType()); + MenuItemDetail menuItemDetail = new MenuItemDetail(appMenu.getMenuId(), appMenu.getMenuParentId(), appMenu.getMenuName(), + appMenu.getMenuType()); appMenuItems.add(menuItemDetail); } // 将应用下的菜单组装成树 List menuItemDetailList = new DefaultTreeBuildFactory().doTreeBuild(appMenuItems); appGroupDetail.setMenuList(menuItemDetailList); + + // 将一级菜单展开 + List openMenuIdList = new ArrayList<>(); + if (ObjectUtil.isEmpty(menuItemDetailList)) { + appGroupDetail.setOpenMenuIdList(openMenuIdList); + } else { + for (MenuItemDetail menuItemDetail : menuItemDetailList) { + if (ObjectUtil.isNotEmpty(menuItemDetail.getChildren())) { + openMenuIdList.add(menuItemDetail.getMenuId()); + } + } + appGroupDetail.setOpenMenuIdList(openMenuIdList); + } } return appGroupDetails; diff --git a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuValidateFactory.java b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuValidateFactory.java index 5aadd44e9..5e318de29 100644 --- a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuValidateFactory.java +++ b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/factory/MenuValidateFactory.java @@ -55,9 +55,6 @@ public class MenuValidateFactory { if (ObjectUtil.isEmpty(sysMenuRequest.getAntdvRouter())) { throw new ServiceException(SysMenuExceptionEnum.URL_CANT_EMPTY); } - if (ObjectUtil.isEmpty(sysMenuRequest.getAntdvComponent())) { - throw new ServiceException(SysMenuExceptionEnum.COMPONENT_PATH_CANT_EMPTY); - } if (ObjectUtil.isEmpty(sysMenuRequest.getAntdvVisible())) { throw new ServiceException(SysMenuExceptionEnum.HIDDEN_FLAG_CANT_EMPTY); } diff --git a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/pojo/response/AppGroupDetail.java b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/pojo/response/AppGroupDetail.java index 24d0beb16..42a06c29e 100644 --- a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/pojo/response/AppGroupDetail.java +++ b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/menu/pojo/response/AppGroupDetail.java @@ -1,5 +1,7 @@ package cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response; +import cn.stylefeng.roses.kernel.file.api.format.FileUrlFormatProcess; +import cn.stylefeng.roses.kernel.rule.annotation.SimpleFieldFormat; import lombok.Data; import java.util.List; @@ -28,6 +30,7 @@ public class AppGroupDetail { /** * 应用图标的文件id */ + @SimpleFieldFormat(processClass = FileUrlFormatProcess.class) private Long appIcon; /** @@ -40,6 +43,11 @@ public class AppGroupDetail { */ private List menuList; + /** + * 展开的菜单id列表 + */ + private List openMenuIdList; + public AppGroupDetail() { } diff --git a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/role/controller/SysRoleController.java b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/role/controller/SysRoleController.java index 8568e3965..2e9f05182 100644 --- a/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/role/controller/SysRoleController.java +++ b/kernel-s-sys/sys-business-permission/src/main/java/cn/stylefeng/roses/kernel/sys/modular/role/controller/SysRoleController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.List; /** * 系统角色控制器 @@ -98,4 +99,17 @@ public class SysRoleController { return new SuccessResponseData<>(sysRoleService.findPage(sysRoleRequest)); } + /** + * 获取所有角色列表 + *

+ * 一般用在用户分配角色,响应所有的角色列表 + * + * @author fengshuonan + * @date 2023/06/10 21:29 + */ + @GetResource(name = "分页查询-角色列表", path = "/sysRole/list") + public ResponseData> list(SysRoleRequest sysRoleRequest) { + return new SuccessResponseData<>(sysRoleService.findList(sysRoleRequest)); + } + }