package com.YuyeTech.TPlat.service.impl;

import com.YuyeTech.TPlat.dataobject.Pictures;
import com.YuyeTech.TPlat.dataobject.UserInfo;
import com.YuyeTech.TPlat.dataobject.UserLevel;
import com.YuyeTech.TPlat.dto.UserDTO;
import com.YuyeTech.TPlat.repository.PicturesRepository;
import com.YuyeTech.TPlat.repository.UserInfoRepository;
import com.YuyeTech.TPlat.repository.UserLevelRepository;
import com.YuyeTech.TPlat.service.UserInfoService;
import com.YuyeTech.TPlat.service.UserLevelService;
import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.PrimitiveIterator;
import java.util.stream.Collectors;

/**
 * 用户记录关卡信息
 * @author:slambb
 * @date:2021/8/5
 */
@Service
public class UserLevelServiceImpl implements UserLevelService {

    @Autowired
    private UserLevelRepository userLevelRepository;

    @Override
    public UserLevel saveUserLevel(UserLevel userLevel) {
        userLevel =  userLevelRepository.saveAndFlush(userLevel);
        return userLevel;
    }


    @Override
    public UserLevel findByUserIdAndEventType(String userId, Integer levelType) {
        return userLevelRepository.findByUserIdAndEventType(userId,levelType).orElse(null);
    }
}

