package com.ssj.service.sys.cardinfo.service.impl;

import com.ssj.bean.sys.cardinfo.domain.CardAward;
import com.ssj.dao.sys.cardinfo.dao.CardAwardDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.sys.cardinfo.service.CardAwardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class CardAwardServiceImpl extends BaseServiceImpl<CardAward, String> implements CardAwardService {
	@Autowired
	private CardAwardDao cardAwardDao;

	@Override
	public PagingAndSortingRepository<CardAward, String> getDao() {
		return cardAwardDao;
	}

	@Override
	public List<CardAward> getCardAwardListByCardId(String cardId) {
		return cardAwardDao.getCardAwardListByCardId(cardId);
	}

	@Override
	public synchronized CardAward getCardAward(String cardId) {
		return cardAwardDao.findByCardIdRand(cardId);
	}

	@Override
	public CardAward findByUserIdAndCardId(String userId, String cardId) {
		return cardAwardDao.findByUserIdAndCardId(userId, cardId);
	}

	@Override
	public CardAward getCardAwardListByCardIdPracelimit(String cardId,
			List<Integer> prace) {
		return cardAwardDao.getCardAwardListByCardIdPracelimit(cardId, prace);
	}

}
