mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
!561 使用封装好的StreamUtils工具类代替项目中的部分stream操作
* refactor : 使用封装好的StreamUtils工具类代替项目中的部分stream操作
This commit is contained in:
@ -37,7 +37,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 角色 业务层处理
|
||||
@ -106,7 +105,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
List<SysRoleVo> userRoles = baseMapper.selectRolesByUserId(userId);
|
||||
List<SysRoleVo> roles = selectRoleAll();
|
||||
// 使用HashSet提高查找效率
|
||||
Set<Long> userRoleIds = userRoles.stream().map(SysRoleVo::getRoleId).collect(Collectors.toSet());
|
||||
Set<Long> userRoleIds = StreamUtils.toSet(userRoles, SysRoleVo::getRoleId);
|
||||
for (SysRoleVo role : roles) {
|
||||
if (userRoleIds.contains(role.getRoleId())) {
|
||||
role.setFlag(true);
|
||||
|
Reference in New Issue
Block a user