package com.YuyeTech.HeartRate.game.versionCode.service;

import com.YuyeTech.HeartRate.common.service.CommonServiceImpl;
import com.YuyeTech.HeartRate.game.versionCode.projo.VersionCode;
import com.YuyeTech.HeartRate.game.versionCode.vo.VersionCodeVo;
import com.YuyeTech.HeartRate.game.versionCode.repository.VersionCodeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author:slambb
 * @date:2021/2/23
 */
@Service
public class VersionCodeServiceImpl  extends CommonServiceImpl<VersionCodeVo, VersionCode, Integer> implements VersionCodeService {


    @Autowired
    private VersionCodeRepository versionCodeRepository;

    @Override
    public VersionCode findByCode(String code) {
        return versionCodeRepository.findByCode(code).orElse(null);

    }

    /**
     * todo 后续用redis优化
     * @param code
     * @param showConfigKey
     * @return
     */
    @Override
    public VersionCode findByVersionCodeAndShowConfigKey(String code, String showConfigKey) {
        return versionCodeRepository.findByCodeAndShowConfigKey(code,showConfigKey).orElse(null);
    }
}
