|
@@ -1,5 +1,6 @@
|
|
|
package com.xy.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -10,6 +11,7 @@ import com.xy.vo.RoleMenuVo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -51,4 +53,15 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
|
|
return saveBatch(roleMenuList);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Long> getMenuIdsByRoleId(Long roleId) {
|
|
|
+ List<Long> menuIds = new ArrayList<>(16);
|
|
|
+ List<SysRoleMenu> sysRoleMenus = this.list(Wrappers.<SysRoleMenu>lambdaQuery().eq(SysRoleMenu::getRoleId, roleId));
|
|
|
+ if (CollUtil.isNotEmpty(sysRoleMenus)) {
|
|
|
+ return menuIds;
|
|
|
+ }
|
|
|
+ menuIds = sysRoleMenus.stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList());
|
|
|
+ return menuIds;
|
|
|
+ }
|
|
|
+
|
|
|
}
|