package com.crm.manager.dao.repository;

import com.crm.rely.backend.core.pojo.table.FinanceRateTable;
import com.crm.rely.backend.core.pojo.table.SysActionTable;
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;

/**
 * @author houn
 */
@Repository
public interface FinanceRateRepository extends BaseRepository<FinanceRateTable> {
    @Lock(LockModeType.PESSIMISTIC_WRITE)
    FinanceRateTable findFirstById(Long id);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    List<FinanceRateTable> findAllByIdIn(List<Long> ids);

    List<FinanceRateTable> findAllByType(Integer type);

    boolean existsByCurrencyAndTransformCurrencyAndType(String currency, String transformCurrency, Integer type);

    FinanceRateTable getFirstById(Long id);

    FinanceRateTable getByTypeAndCurrencyAndTransformCurrency(Integer type, String currency, String transformCurrency);

}
