if (loginUser.getRoles().stream().anyMatch(dto -> dto.equals(" SecurityDepartment")))
时间: 2024-05-19 08:14:09 浏览: 122
用户登录分配不同角色
4星 · 用户满意度95%
This code checks if the loginUser object has a role called "SecurityDepartment". The getRoles() method returns a list of roles that the user has, and the stream() method is used to iterate over the list. The anyMatch() method checks if any of the roles in the list match the "SecurityDepartment" role. If there is a match, the code inside the if statement will be executed.
阅读全文