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

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.ssj.bean.sys.award.domain.AwardConsume;
import com.ssj.dao.sys.award.dao.AwardConsumeDao;
import com.ssj.dao.sys.award.dao.AwardQueryDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.sys.award.service.AwardConsumeService;

@Service(version = "1.0")
@Transactional
public class AwardConsumeServiceImpl extends BaseServiceImpl<AwardConsume, String> implements AwardConsumeService {
	
	@Autowired
	private AwardConsumeDao  awardConsumeDao;
	
	@Autowired
	private AwardQueryDao  queryDao;

	@Override
	public PagingAndSortingRepository<AwardConsume, String> getDao() {
		return awardConsumeDao;
	}

	@Override
	public Page<Map<String, Object>> findAwardConsumeBylist(Map<String, Object> searchParams, Pageable pageable) {
		return queryDao.findAwardConsumeBylist(searchParams, pageable);
	}

	@Override
	public void saveAwardConsumeLog(AwardConsume awardConsume) {
		awardConsume.setCreateTime(new Date());
		this.save(awardConsume);
	}

	@Override
	public Page<Map<String, Object>> findAwardConsumeByAwardMaterial(Map<String, Object> searchParams,Pageable pageable) {
		return queryDao.findAwardConsumeByAwardMaterial(searchParams, pageable);
	}

	@Override
	public void saveAwardConsumeLog(List<AwardConsume> awardConsumes) {
		for (AwardConsume awardConsume : awardConsumes) {
			this.saveAwardConsumeLog(awardConsume);
		}
	}


	
}
