package com.crm.globex.dao.repository;

import com.crm.rely.backend.dao.repository.BaseRepository;
import com.crm.rely.backend.model.pojo.table.FinanceDepositTable;
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 FinanceDepositRepository extends BaseRepository<FinanceDepositTable> {

    List<FinanceDepositTable> findAllByStatusAndDepositStatus(Integer status, Integer depositStatus);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    FinanceDepositTable findFirstBySerial(String serial);
}
