package com.YuyeTech.TPlat.service.impl;

import com.YuyeTech.TPlat.dataobject.UserLevel;
import com.YuyeTech.TPlat.repository.UserLevelRepository;
import com.YuyeTech.TPlat.service.UserLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户记录关卡信息
 * @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);
    }
}

