package com.crm.ucard.dao.repository;

import com.crm.rely.backend.core.pojo.table.ucard.UcardWalletWithdrawTable;
import com.crm.rely.backend.dao.repository.BaseRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

import javax.persistence.LockModeType;

@Repository
public interface UcardWalletWithdrawRepository extends BaseRepository<UcardWalletWithdrawTable> {

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    UcardWalletWithdrawTable findFirstById(Long id);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    UcardWalletWithdrawTable findFirstByRequestIdAndAddress(String requestId, String address);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    UcardWalletWithdrawTable findFirstByAddressAndBlockchain(String address, String blockchain);
}
