package com.neusoft.smart.pos.card.persistent.repository;

import com.neusoft.smart.pos.card.persistent.domain.Card;
import com.neusoft.smart.pos.card.persistent.domain.CardOrder;
import com.neusoft.smart.pos.card.persistent.domain.CardRefundOrder;
import com.neusoft.smart.pos.card.persistent.mapper.CardRefundOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CardRefundOrderRepository {
	
	@Autowired
	private CardRefundOrderMapper cardRefundOrderMapper;

	public void createRefundOrder(CardRefundOrder cardRefundOrder) {
		cardRefundOrderMapper.insertSelective(cardRefundOrder);
    }

	public void updateByPrimarykey(CardRefundOrder cardRefundOrder) {
		cardRefundOrderMapper.updateByPrimaryKey(cardRefundOrder);
	}


//	public CardOrder getCardOrderByCardTradeNum(String cardTradeNum) {
//		CardOrderExample cardOrderExample = new CardOrderExample();
//        cardOrderExample.createCriteria().andCardTradeNumEqualTo(cardTradeNum);
//		return cardOrderMapper.selectByExample(cardOrderExample).stream().findAny().orElse(null);
//	}
//
//	public Card getActiveCardByMemberId(Integer memberId) {
//		CardExample cardExample = new CardExample();
//		cardExample.createCriteria().andMemberIdEqualTo(memberId).andIsActiveEqualTo(1);
//		return cardMapper.selectByExample(cardExample).stream().findAny().orElse(null);
//	}
//
//	public String getCardNumByMemberid(Integer memberId) {
//		CardExample cardExample = new CardExample();
//		cardExample.createCriteria().andMemberIdEqualTo(memberId).andIsActiveEqualTo(1);
//		Card card = cardMapper.selectByExample(cardExample).stream().findAny().orElse(null);
//		return card.getCardNum();
//	}
//
//	public CardOrder get(Integer cardOrder){
//		return cardOrderMapper.selectByPrimaryKey(cardId);
//	}
//
//	public Integer update(Card card, CardExample cardExample) {
//		return cardMapper.updateByExampleSelective(card, cardExample);
//	}
	
}
