package com.ym.mec.biz.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ym.mec.biz.dal.dao.LuckDrawLogDao;
import com.ym.mec.biz.dal.entity.LuckDrawLog;
import com.ym.mec.biz.service.LuckDrawLogService;
import com.ym.mec.common.dal.BaseDAO;
import com.ym.mec.common.service.impl.BaseServiceImpl;

@Service
public class LuckDrawLogServiceImpl extends BaseServiceImpl<Long, LuckDrawLog> implements LuckDrawLogService {

	@Autowired
	private LuckDrawLogDao luckDrawLogDao;

	@Override
	public BaseDAO<Long, LuckDrawLog> getDAO() {
		return luckDrawLogDao;
	}

	@Override
	public boolean add(Long userId, Integer prizeId, Integer groupId) {
		LuckDrawLog log = new LuckDrawLog();
		log.setPrizeId(prizeId);
		log.setUserId(userId);
		log.setGroupId(groupId);
		log.setCreateOn(new Date());
		return luckDrawLogDao.insert(log) > 0;
	}

}
