fix: 修复菜单修改问题

This commit is contained in:
2023-05-10 16:00:52 +08:00
parent 1aa8203011
commit 26e12b7e4f

View File

@@ -190,8 +190,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
public void update(SysMenu resources) {
String menuId = resources.getMenu_id();
SysMenu menu = baseMapper.selectById(menuId);
List<String> allChildIds = Arrays.asList(baseMapper.findAllChild(menuId).split(","));
if (allChildIds.contains(resources.getPid())){
String allChild = baseMapper.findAllChild(menuId); // 获取当前菜单的所有子菜单
List<String> allChildIds = ObjectUtil.isNotEmpty(allChild)?Arrays.asList(allChild.split(",")):null;
if (ObjectUtil.isNotEmpty(allChildIds) && allChildIds.contains(resources.getPid())){
throw new BadRequestException("上级不能为自己或自己的下级");
}
if (resources.getIframe()) {