用户 有一个 角色 用System.out.println(user.getRoles().contains(role));判断 都是 false; 这个是为什么呢
User user = userService.fetch(id);
userService.fetchLinks(user,"dept|roles");
List<Role> roles = roleService.query(Cnd.where("status","=",false).and("del_flag","=",false));
roles.forEach(role -> {
if(user.getRoles()!=null && user.getRoles().size()>0){
System.out.println(user.getRoles().contains(role));
role.setFlag(user.getRoles().contains(role));
}
});
req.setAttribute("user",user);
req.setAttribute("roles",roles);