package com.wechat.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.wechat.global.base.dao.impl.BaseDao;
import com.wechat.model.dbEntity.MdeExchangeHis;
import com.wechat.model.dto.ActivityDetailDto;
import com.wechat.model.dto.ActivityInfoDto;
import com.wechat.model.dto.ExchangeHisDto;

@Repository
public class MdeActivityCategoryDao extends BaseDao{
 
	public ActivityInfoDto getActivityInfo(String actId) {
        return super.selectOne("MdeActivityCategoryMapper.getActivityInfo", actId);
    }
	
	public List<ActivityDetailDto> getActivityDetails(String actId) {
        return super.select("MdeActivityDetailMapper.getActivityDetails", actId);
    }
	
	//提交兑换请求
	public int insertExchangeRequest(MdeExchangeHis exchangeHis) {
		exchangeHis.setCreateBy(exchangeHis.getUserCode());
		exchangeHis.setUpdateBy(exchangeHis.getUserCode());
        return super.insert("MdeExchangeHisMapper.insertExchangeRequest", exchangeHis);
    }
	
	//获取兑换履历	
	public List<ExchangeHisDto> getExchangeHis(String actId, String userCode) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userCode", userCode);
		map.put("actId", actId);
        return super.select("MdeExchangeHisMapper.getExchangeHis", map);
    }
	
	//撤销兑换请求
	public int cancelExchangeRequest(MdeExchangeHis exchangeHis) {
        return super.delete("MdeExchangeHisMapper.deleteExchangeRequest", exchangeHis);
    }
	
	//获取活动id
	public List<String> getActIds() {
        return super.select("MdeActivityCategoryMapper.getActIds");
    }
	
}