新增接口 根据目录ID查询所有的父级目录ID
This commit is contained in:
parent
102b94e4d1
commit
f38e3e9bc7
@ -160,15 +160,18 @@ public class SqMenuController extends BaseController
|
|||||||
// * 批量更新书签的数量
|
// * 批量更新书签的数量
|
||||||
// */
|
// */
|
||||||
//
|
//
|
||||||
// @RequestMapping("/bookmarkcount")
|
@RequestMapping("/bookmarkcount")
|
||||||
// public void bookmarkcount()
|
public void bookmarkcount()
|
||||||
// {
|
{
|
||||||
//
|
|
||||||
// Long[] menuIds={1L,2L,3L};
|
// Long[] menuIds={1L,2L,3L};
|
||||||
//
|
|
||||||
// sqMenuService.updateCountAdd(menuIds,5);
|
// sqMenuService.updateCountAdd(menuIds,5);
|
||||||
// logger.info("执行完毕");
|
Long[] menuIds= sqMenuService.selectBymenuidParentid(4L);//所有的父级目录
|
||||||
// }
|
sqMenuService.updateCountAdd(menuIds,5);
|
||||||
|
|
||||||
|
logger.info("执行完毕");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,15 @@ import com.ruoyi.bookmark.domain.SqMenu;
|
|||||||
public interface ISqMenuService
|
public interface ISqMenuService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 目录菜单的 所有父级ID
|
||||||
|
*
|
||||||
|
* @param menuId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public Long[] selectBymenuidParentid(Long menuId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量减少目录下书签数量
|
* 批量减少目录下书签数量
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.bookmark.service.impl;
|
package com.ruoyi.bookmark.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -20,6 +21,31 @@ public class SqMenuServiceImpl implements ISqMenuService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SqMenuMapper sqMenuMapper;
|
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
|
* @auther: Wang
|
||||||
* @date: 2020/08/16 20:04
|
* @date: 2020/08/16 20:04
|
||||||
|
Loading…
x
Reference in New Issue
Block a user