diff --git a/opsli-api/src/main/java/org/opsli/api/web/system/menu/MenuApi.java b/opsli-api/src/main/java/org/opsli/api/web/system/menu/MenuApi.java index 8f9df22..57679b7 100644 --- a/opsli-api/src/main/java/org/opsli/api/web/system/menu/MenuApi.java +++ b/opsli-api/src/main/java/org/opsli/api/web/system/menu/MenuApi.java @@ -61,7 +61,7 @@ public interface MenuApi { /** * 懒加载列表菜单 * @param parentId 父节点ID - * @return + * @return ResultVo */ @GetMapping("/findMenuTreePageByLazy") ResultVo findMenuTreePageByLazy(String parentId); @@ -69,11 +69,11 @@ public interface MenuApi { /** * 懒加载菜单 * @param parentId 父节点ID - * @return + * @param id 自身ID (不为空 则排除自身) + * @return ResultVo */ @GetMapping("/findMenuTreeByLazy") - ResultVo findMenuTreeByLazy(String parentId); - + ResultVo findMenuTreeByLazy(String parentId, String id); /** * 获得当前用户登录菜单 diff --git a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/menu/web/MenuRestController.java b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/menu/web/MenuRestController.java index e19e4dd..2a503ec 100644 --- a/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/menu/web/MenuRestController.java +++ b/opsli-modulars/opsli-modulars-system/src/main/java/org/opsli/modulars/system/menu/web/MenuRestController.java @@ -167,13 +167,15 @@ public class MenuRestController extends BaseRestController findMenuTreeByLazy(String parentId) { + public ResultVo findMenuTreeByLazy(String parentId, String id) { List menuModelList; if(StringUtils.isEmpty(parentId)){ menuModelList = Lists.newArrayList(); @@ -190,9 +192,17 @@ public class MenuRestController extends BaseRestController queryBuilder = new GenQueryBuilder<>(); QueryWrapper queryWrapper = queryBuilder.build(); - queryWrapper.eq(HumpUtil.humpToUnderline(MyBatisConstants.FIELD_PARENT_ID), parentId); + queryWrapper.eq( + HumpUtil.humpToUnderline(MyBatisConstants.FIELD_PARENT_ID), parentId); queryWrapper.eq("type", "1"); + // 如果传入ID 则不包含自身 + if(StringUtils.isNotEmpty(id)){ + queryWrapper.notIn( + HumpUtil.humpToUnderline(MyBatisConstants.FIELD_ID), id); + + } + // 获得菜单 List menuList = IService.findList(queryWrapper); menuModelList = WrapperUtil.transformInstance(menuList, MenuModel.class);