@Test public void checkIsRootByUserId() { long userId = mockData(); boolean exist = groupService.checkIsRootByUserId(userId); assertFalse(exist); }
@Override public boolean checkIsRootByUserId(Long userId) { QueryWrapper<UserGroupDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserGroupDO::getUserId, userId) .eq(UserGroupDO::getGroupId, rootGroupId); UserGroupDO relation = userGroupMapper.selectOne(wrapper); return relation != null; }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public boolean checkIsRootByUserId(Long userId) { QueryWrapper<UserGroupDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserGroupDO::getUserId, userId) .eq(UserGroupDO::getGroupId, rootGroupId); UserGroupDO relation = userGroupMapper.selectOne(wrapper); return relation != null; } }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public boolean checkIsRootByUserId(Long userId) { QueryWrapper<UserGroupDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserGroupDO::getUserId, userId) .eq(UserGroupDO::getGroupId, rootGroupId); UserGroupDO relation = userGroupMapper.selectOne(wrapper); return relation != null; }  }
GroupServiceImpl extends ServiceImpl<GroupMapper, GroupDO> implements GroupService { @Override public boolean checkIsRootByUserId(Long userId) { QueryWrapper<UserGroupDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserGroupDO::getUserId, userId) .eq(UserGroupDO::getGroupId, rootGroupId); UserGroupDO relation = userGroupMapper.selectOne(wrapper); return relation != null; }  @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 boolean checkIsRootByUserId(Long userId) { QueryWrapper<UserGroupDO> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(UserGroupDO::getUserId, userId) .eq(UserGroupDO::getGroupId, rootGroupId); UserGroupDO relation = userGroupMapper.selectOne(wrapper); return relation != null; }  @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);  }