class GroupDatabaseService {

    public boolean validateTransferPermision(Long userId, Long dbId) throws SQLException {
        List<UserGroup> urGroups = userGroupDao.getUserGroupByUserId(userId);
        if (CollectionUtils.isNotEmpty(urGroups)) {
            for (UserGroup urGroup : urGroups) {
                List<DataBaseInfo> dataBaseInfos = dataBaseDao.getGroupDBsByGroup(urGroup.getGroup_id());
                if (CollectionUtils.isNotEmpty(dataBaseInfos)) {
                    return dataBaseInfos.stream().anyMatch(db -> db.getId().equals(dbId));
                }
            }
        }
        return false;
    }

}