From 558ffc4bcaf7aa5c683e7c9ce01e971feb9e4d95 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期一, 14 十月 2024 14:11:48 +0800
Subject: [PATCH] 模型打包租户隔离 备份文件租户隔离

---
 iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/permission/MenuController.java |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/permission/MenuController.java b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/permission/MenuController.java
index d7eba44..67553f1 100644
--- a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/permission/MenuController.java
+++ b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/controller/admin/permission/MenuController.java
@@ -40,10 +40,26 @@
         return success(menuId);
     }
 
+    @PostMapping("/createAppMenu")
+    @Operation(summary = "创建菜单")
+    @PreAuthorize("@ss.hasPermission('system:app-menu:create')")
+    public CommonResult<Long> createAppMenu(@Valid @RequestBody MenuSaveVO createReqVO) {
+        Long menuId = menuService.createMenu(createReqVO);
+        return success(menuId);
+    }
+
     @PutMapping("/update")
     @Operation(summary = "修改菜单")
     @PreAuthorize("@ss.hasPermission('system:menu:update')")
     public CommonResult<Boolean> updateMenu(@Valid @RequestBody MenuSaveVO updateReqVO) {
+        menuService.updateMenu(updateReqVO);
+        return success(true);
+    }
+
+    @PutMapping("/updateAppMenu")
+    @Operation(summary = "修改菜单")
+    @PreAuthorize("@ss.hasPermission('system:app-menu:update')")
+    public CommonResult<Boolean> updateAppMenu(@Valid @RequestBody MenuSaveVO updateReqVO) {
         menuService.updateMenu(updateReqVO);
         return success(true);
     }
@@ -57,11 +73,30 @@
         return success(true);
     }
 
+    @DeleteMapping("/deleteAppMenu")
+    @Operation(summary = "删除菜单")
+    @Parameter(name = "id", description = "菜单编号", required= true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('system:app-menu:delete')")
+    public CommonResult<Boolean> deleteAppMenu(@RequestParam("id") Long id) {
+        menuService.deleteMenu(id);
+        return success(true);
+    }
+
+
     @GetMapping("/list")
     @Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面")
     @PreAuthorize("@ss.hasPermission('system:menu:query')")
     public CommonResult<List<MenuRespVO>> getMenuList(MenuListReqVO reqVO) {
         List<MenuDO> list = menuService.getMenuList(reqVO);
+        list.sort(Comparator.comparing(MenuDO::getSort));
+        return success(BeanUtils.toBean(list, MenuRespVO.class));
+    }
+
+    @GetMapping("/app-menu-list")
+    @Operation(summary = "获取应用菜单列表", description = "用于【应用菜单】界面")
+    @PreAuthorize("@ss.hasPermission('system:app-menu:query')")
+    public CommonResult<List<MenuRespVO>> getAppMenuList(MenuListReqVO reqVO) {
+        List<MenuDO> list = menuService.getAppMenuList(reqVO);
         list.sort(Comparator.comparing(MenuDO::getSort));
         return success(BeanUtils.toBean(list, MenuRespVO.class));
     }
@@ -76,6 +111,16 @@
         return success(BeanUtils.toBean(list, MenuSimpleRespVO.class));
     }
 
+    @GetMapping({"simple-app-menus"})
+    @Operation(summary = "获取应用菜单精简信息列表", description = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。" +
+            "在多租户的场景下,会只返回租户所在套餐有的菜单")
+    public CommonResult<List<MenuSimpleRespVO>> getSimpleAppMenuList() {
+        List<MenuDO> list = menuService.getAppMenuListByTenant(
+                new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
+        list.sort(Comparator.comparing(MenuDO::getSort));
+        return success(BeanUtils.toBean(list, MenuSimpleRespVO.class));
+    }
+
     @GetMapping("/get")
     @Operation(summary = "获取菜单信息")
     @PreAuthorize("@ss.hasPermission('system:menu:query')")
@@ -84,4 +129,12 @@
         return success(BeanUtils.toBean(menu, MenuRespVO.class));
     }
 
+    @GetMapping("/getAppMenu")
+    @Operation(summary = "获取菜单信息")
+    @PreAuthorize("@ss.hasPermission('system:app-menu:query')")
+    public CommonResult<MenuRespVO> getAppMenu(Long id) {
+        MenuDO menu = menuService.getMenu(id);
+        return success(BeanUtils.toBean(menu, MenuRespVO.class));
+    }
+
 }

--
Gitblit v1.9.3