package com.crm.ucard.dao.repository;

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

import javax.persistence.LockModeType;
import java.util.List;

@Repository
public interface CardTransacOrderRepository extends BaseRepository<CardTransacOrderTable> {

    List<CardTransacOrderTable> findByCardNoIn(List<String> allCardNos);

    List<CardTransacOrderTable> findByCardNo(String allCardNos);

    CardTransacOrderTable getFirstById(Long id);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    CardTransacOrderTable findByCardNoAndTradeNo(String cardNo, String tradeNo);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    CardTransacOrderTable findByMerchantOrderNo(String merchantOrderNo);

}
