@Test public void deleteGroup() { GroupDO group = GroupDO.builder().name("测试分组1").info("just for test").build(); groupMapper.insert(group); boolean ok = adminService.deleteGroup(group.getId()); assertTrue(ok); GroupDO selected = groupMapper.selectById(group.getId()); assertNull(selected); }
@Override public boolean deleteGroup(Long id) { if (id.equals(rootGroupId)) { throw new ForbiddenException("root group can't delete", 10074); } if (id.equals(guestGroupId)) { throw new ForbiddenException("guest group can't delete", 10075); } throwGroupNotExistById(id); return groupService.removeById(id); }
AdminServiceImpl implements AdminService { @Override public boolean deleteGroup(Long id) { if (id.equals(rootGroupId)) { throw new ForbiddenException("root group can't delete", 10074); } if (id.equals(guestGroupId)) { throw new ForbiddenException("guest group can't delete", 10075); } throwGroupNotExistById(id); return groupService.removeById(id); } }
AdminServiceImpl implements AdminService { @Override public boolean deleteGroup(Long id) { if (id.equals(rootGroupId)) { throw new ForbiddenException("root group can't delete", 10074); } if (id.equals(guestGroupId)) { throw new ForbiddenException("guest group can't delete", 10075); } throwGroupNotExistById(id); return groupService.removeById(id); }  }
AdminServiceImpl implements AdminService { @Override public boolean deleteGroup(Long id) { if (id.equals(rootGroupId)) { throw new ForbiddenException("root group can't delete", 10074); } if (id.equals(guestGroupId)) { throw new ForbiddenException("guest group can't delete", 10075); } throwGroupNotExistById(id); return groupService.removeById(id); }  @Override IPage<UserDO> getUserPageByGroupId(Long groupId, Long count, Long page); @Override boolean changeUserPassword(Long id, ResetPasswordDTO dto); @Transactional @Override boolean deleteUser(Long id); @Override boolean updateUserInfo(Long id, UpdateUserInfoDTO validator); @Override IPage<GroupDO> getGroupPage(Long page, Long count); @Override GroupPermissionsBO getGroup(Long id); @Transactional @Override boolean createGroup(NewGroupDTO dto); @Override boolean updateGroup(Long id, UpdateGroupDTO dto); @Override boolean deleteGroup(Long id); @Override boolean dispatchPermission(DispatchPermissionDTO dto); @Override boolean dispatchPermissions(DispatchPermissionsDTO dto); @Override boolean removePermissions(RemovePermissionsDTO dto); @Override List<GroupDO> getAllGroups(); @Override List<PermissionDO> getAllPermissions(); @Override Map<String, List<PermissionDO>> getAllStructualPermissions(); }
AdminServiceImpl implements AdminService { @Override public boolean deleteGroup(Long id) { if (id.equals(rootGroupId)) { throw new ForbiddenException("root group can't delete", 10074); } if (id.equals(guestGroupId)) { throw new ForbiddenException("guest group can't delete", 10075); } throwGroupNotExistById(id); return groupService.removeById(id); }  @Override IPage<UserDO> getUserPageByGroupId(Long groupId, Long count, Long page); @Override boolean changeUserPassword(Long id, ResetPasswordDTO dto); @Transactional @Override boolean deleteUser(Long id); @Override boolean updateUserInfo(Long id, UpdateUserInfoDTO validator); @Override IPage<GroupDO> getGroupPage(Long page, Long count); @Override GroupPermissionsBO getGroup(Long id); @Transactional @Override boolean createGroup(NewGroupDTO dto); @Override boolean updateGroup(Long id, UpdateGroupDTO dto); @Override boolean deleteGroup(Long id); @Override boolean dispatchPermission(DispatchPermissionDTO dto); @Override boolean dispatchPermissions(DispatchPermissionsDTO dto); @Override boolean removePermissions(RemovePermissionsDTO dto); @Override List<GroupDO> getAllGroups(); @Override List<PermissionDO> getAllPermissions(); @Override Map<String, List<PermissionDO>> getAllStructualPermissions();  }