新增接口 根据目录ID查询所有的父级目录ID
This commit is contained in:
		| @@ -12,6 +12,15 @@ import com.ruoyi.bookmark.domain.SqMenu; | ||||
| public interface ISqMenuService | ||||
| { | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 查询 目录菜单的 所有父级ID | ||||
|      * | ||||
|      * @param menuId | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public Long[] selectBymenuidParentid(Long menuId); | ||||
|  | ||||
|     /** | ||||
|      * 批量减少目录下书签数量 | ||||
|      * | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package com.ruoyi.bookmark.service.impl; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -20,6 +21,31 @@ public class SqMenuServiceImpl implements ISqMenuService | ||||
|     @Autowired | ||||
|     private SqMenuMapper sqMenuMapper; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 查询 目录菜单的 所有父级ID | ||||
|      * | ||||
|      * @param menuId | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public Long[] selectBymenuidParentid(Long menuId){ | ||||
|  | ||||
|         List<Long> menuIds=new ArrayList<>(); | ||||
|  | ||||
|         while (!menuId.toString().equals("0")) { | ||||
|             SqMenu sqMenu = sqMenuMapper.selectSqMenuById(menuId); | ||||
|             if (!sqMenu.getParentId().toString().equals("0")) { | ||||
|                 menuIds.add(sqMenu.getParentId()); | ||||
|             } | ||||
|             menuId = sqMenu.getParentId(); | ||||
|         } | ||||
|         Long[] menuIdArry = menuIds.toArray(new Long[menuIds.size()]); | ||||
|         return  menuIdArry; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @auther: Wang | ||||
|      * @date: 2020/08/16 20:04 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user