package com.bizzan.bitrade.service;

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

import com.bizzan.bitrade.dao.WithdrawBackupDao;
import com.bizzan.bitrade.entity.WithdrawBackup;
import com.bizzan.bitrade.service.Base.BaseService;

@Service
public class WithdrawBackupService extends BaseService {
	@Autowired
    private WithdrawBackupDao withdrawBackupDao;
	
	public void saveWithdrawBackup(Long recordId, Long memberId, String address, String unit) {
		WithdrawBackup withdrawBackup = new WithdrawBackup();
		withdrawBackup.setMemberId(memberId);
		withdrawBackup.setAddress(address);
		withdrawBackup.setCoinId(unit);
		withdrawBackup.setRecordId(recordId);
		withdrawBackupDao.saveAndFlush(withdrawBackup);
		
	}
	
	public WithdrawBackup findByCoinUnitAndMemberId(String unit, Long memberId, Long recordId, String address) {
		return withdrawBackupDao.findByCoinIdAndMemberIdAndRecordIdAndAddress(unit, memberId,recordId,address);
	}
}
