@Test public void getGroupAndPermissions() { Long id = mockData2(); GroupPermissionsBO groupAndPermissions = groupService.getGroupAndPermissions(id); assertTrue(groupAndPermissions.getName().equals("测试分组1")); boolean anyMatch = groupAndPermissions.getPermissions().stream().anyMatch(permission -> { PermissionDO permission1 = (PermissionDO) permission; return permission1.getName().equals("权限2"); }); assertTrue(anyMatch); }
@Override public GroupPermissionsBO getGroupAndPermissions(Long id) { GroupDO group = this.baseMapper.selectById(id); List<PermissionDO> permissions = permissionService.getPermissionByGroupId(id); return new GroupPermissionsBO(group, permissions); }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public GroupPermissionsBO getGroupAndPermissions(Long id) { GroupDO group = this.baseMapper.selectById(id); List<PermissionDO> permissions = permissionService.getPermissionByGroupId(id); return new GroupPermissionsBO(group, permissions); } }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public GroupPermissionsBO getGroupAndPermissions(Long id) { GroupDO group = this.baseMapper.selectById(id); List<PermissionDO> permissions = permissionService.getPermissionByGroupId(id); return new GroupPermissionsBO(group, permissions); }  }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public GroupPermissionsBO getGroupAndPermissions(Long id) { GroupDO group = this.baseMapper.selectById(id); List<PermissionDO> permissions = permissionService.getPermissionByGroupId(id); return new GroupPermissionsBO(group, permissions); }  @Override List<GroupDO> getUserGroupsByUserId(Long userId); @Override List<Long> getUserGroupIdsByUserId(Long userId); @Override IPage<GroupDO> getGroupPage(long page, long count); @Override boolean checkGroupExistById(Long id); @Override GroupPermissionsBO getGroupAndPermissions(Long id); @Override boolean checkGroupExistByName(String name); @Override boolean checkIsRootByUserId(Long userId); @Override boolean deleteUserGroupRelations(Long userId, List<Long> deleteIds); @Override boolean addUserGroupRelations(Long userId, List<Long> addIds); }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public GroupPermissionsBO getGroupAndPermissions(Long id) { GroupDO group = this.baseMapper.selectById(id); List<PermissionDO> permissions = permissionService.getPermissionByGroupId(id); return new GroupPermissionsBO(group, permissions); }  @Override List<GroupDO> getUserGroupsByUserId(Long userId); @Override List<Long> getUserGroupIdsByUserId(Long userId); @Override IPage<GroupDO> getGroupPage(long page, long count); @Override boolean checkGroupExistById(Long id); @Override GroupPermissionsBO getGroupAndPermissions(Long id); @Override boolean checkGroupExistByName(String name); @Override boolean checkIsRootByUserId(Long userId); @Override boolean deleteUserGroupRelations(Long userId, List<Long> deleteIds); @Override boolean addUserGroupRelations(Long userId, List<Long> addIds);  }