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

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;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

@Service
@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);
		}
	}


	
}
