use of com.zy.usercenteradmin.entity.RoleMenuRel in project usercenteradmin by caijiya.
the class RoleServiceImpl method grantMenus.
@Override
@Transactional(rollbackFor = Exception.class)
public void grantMenus(GrantMenuDTO grantMenuDTO) {
roleMenuRelService.remove(new LambdaQueryWrapper<RoleMenuRel>().eq(RoleMenuRel::getRoleId, grantMenuDTO.getRoleId()));
roleMenuRelService.saveBatch(grantMenuDTO.getMenuIds().stream().map(menuId -> {
RoleMenuRel roleMenuRel = new RoleMenuRel();
roleMenuRel.setRoleId(roleMenuRel.getRoleId());
roleMenuRel.setMenuId(menuId);
return roleMenuRel;
}).collect(Collectors.toList()));
}
Aggregations