package com.ssj.service.conch.game.service.impl;

import com.ssj.bean.sys.game.domain.GameRecord;
import com.ssj.dao.sys.game.dao.GameRecordDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.conch.game.service.GameRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Mount Liu
 * @date 2018/2/19
 */
@Service
@Transactional
public class GameRecordServiceImpl extends BaseServiceImpl<GameRecord, String> implements GameRecordService {

    @Autowired
    private GameRecordDao dao;

    @Override
    public PagingAndSortingRepository<GameRecord, String> getDao() {
        return dao;
    }


    @Override
    public void deleteByUserId(String userId) {
        dao.deleteRecordsByUserId(userId);
    }

    @Override
    public GameRecord findByUserIdAndLevel(String userId, int level) {
        return dao.findByUserIdAndLevel(userId, level);
    }

    @Override
    public GameRecord findByUserIdAndGameRespondentIdAndLevel(String userId, String gameRespondentId, Integer level) {
        return dao.findByUserIdAndGameRespondentIdAndLevel(userId, gameRespondentId, level);
    }
}
