| | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | import static com.iailab.framework.tenant.core.context.TenantContextHolder.getTenantId; |
| | | |
| | | @Tag(name = "管理后台 - 菜单") |
| | | @RestController |
| | |
| | | @Operation(summary = "获取应用菜单列表", description = "用于【应用菜单】界面") |
| | | @PreAuthorize("@ss.hasPermission('system:app-menu:query')") |
| | | public CommonResult<List<MenuRespVO>> getAppMenuList(MenuListReqVO reqVO) { |
| | | List<MenuDO> list = menuService.getAppMenuList(reqVO); |
| | | // 获取 tenantId |
| | | Long tenantId = getTenantId(); |
| | | // 管理员租户不在此管理菜单 |
| | | if(tenantId == 1l) { |
| | | return error(-1, "管理员租户请在“菜单管理”中管理菜单!"); |
| | | } |
| | | List<MenuDO> list = menuService.getAppMenuList(tenantId, reqVO); |
| | | list.sort(Comparator.comparing(MenuDO::getSort)); |
| | | return success(BeanUtils.toBean(list, MenuRespVO.class)); |
| | | } |