From 17f0c20242c6ee3d35b9ee8f677d747ed012423c Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 02 九月 2022 16:30:20 +0800 Subject: [PATCH] remove 移除maven docker插件 过于老旧功能缺陷大 使用idea自带的docker插件替代 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java | 93 +++++++++++++++++++++------------------------- 1 files changed, 42 insertions(+), 51 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 9ab5796..2000fd0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -1,15 +1,16 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.lang.tree.Tree; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysMenuService; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -20,57 +21,58 @@ /** * 鑿滃崟淇℃伅 * - * @author ruoyi + * @author Lion Li */ +@Validated +@RequiredArgsConstructor @RestController @RequestMapping("/system/menu") -public class SysMenuController extends BaseController -{ - @Autowired - private ISysMenuService menuService; +public class SysMenuController extends BaseController { + + private final ISysMenuService menuService; /** * 鑾峰彇鑿滃崟鍒楄〃 */ @SaCheckPermission("system:menu:list") @GetMapping("/list") - public AjaxResult list(SysMenu menu) - { + public R<List<SysMenu>> list(SysMenu menu) { List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); - return AjaxResult.success(menus); + return R.ok(menus); } /** * 鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅 + * + * @param menuId 鑿滃崟ID */ @SaCheckPermission("system:menu:query") @GetMapping(value = "/{menuId}") - public AjaxResult getInfo(@PathVariable Long menuId) - { - return AjaxResult.success(menuService.selectMenuById(menuId)); + public R<SysMenu> getInfo(@PathVariable Long menuId) { + return R.ok(menuService.selectMenuById(menuId)); } /** * 鑾峰彇鑿滃崟涓嬫媺鏍戝垪琛� */ @GetMapping("/treeselect") - public AjaxResult treeselect(SysMenu menu) - { + public R<List<Tree<Long>>> treeselect(SysMenu menu) { List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); - return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); + return R.ok(menuService.buildMenuTreeSelect(menus)); } /** * 鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍� + * + * @param roleId 瑙掕壊ID */ @GetMapping(value = "/roleMenuTreeselect/{roleId}") - public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) - { - List<SysMenu> menus = menuService.selectMenuList(getUserId()); - Map<String,Object> ajax = new HashMap<>(); + public R<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { + List<SysMenu> menus = menuService.selectMenuList(getUserId()); + Map<String, Object> ajax = new HashMap<>(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("menus", menuService.buildMenuTreeSelect(menus)); - return AjaxResult.success(ajax); + return R.ok(ajax); } /** @@ -79,15 +81,11 @@ @SaCheckPermission("system:menu:add") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysMenu menu) - { - if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) - { - return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); - } - else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) - { - return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�"); + public R<Void> add(@Validated @RequestBody SysMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { + return R.fail("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { + return R.fail("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�"); } return toAjax(menuService.insertMenu(menu)); } @@ -98,38 +96,31 @@ @SaCheckPermission("system:menu:edit") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysMenu menu) - { - if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) - { - return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); - } - else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) - { - return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�"); - } - else if (menu.getMenuId().equals(menu.getParentId())) - { - return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁"); + public R<Void> edit(@Validated @RequestBody SysMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) { + return R.fail("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪"); + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { + return R.fail("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�"); + } else if (menu.getMenuId().equals(menu.getParentId())) { + return R.fail("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁"); } return toAjax(menuService.updateMenu(menu)); } /** * 鍒犻櫎鑿滃崟 + * + * @param menuId 鑿滃崟ID */ @SaCheckPermission("system:menu:remove") @Log(title = "鑿滃崟绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{menuId}") - public AjaxResult remove(@PathVariable("menuId") Long menuId) - { - if (menuService.hasChildByMenuId(menuId)) - { - return AjaxResult.error("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�"); + public R<Void> remove(@PathVariable("menuId") Long menuId) { + if (menuService.hasChildByMenuId(menuId)) { + return R.fail("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�"); } - if (menuService.checkMenuExistRole(menuId)) - { - return AjaxResult.error("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�"); + if (menuService.checkMenuExistRole(menuId)) { + return R.fail("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�"); } return toAjax(menuService.deleteMenuById(menuId)); } -- Gitblit v1.9.3