package com.crm.globex.dao.repository;

import com.crm.rely.backend.dao.repository.BaseRepository;
import com.crm.rely.backend.model.pojo.table.AccountApplyTable;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

import javax.persistence.LockModeType;

/**
 * @author: houn
 */
@Repository
public interface AccountApplyRepository extends BaseRepository<AccountApplyTable> {

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    AccountApplyTable findFirstByStatus(Integer status);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    AccountApplyTable findFirstByAccountStatusAndStatus(Integer accountStatus,  Integer status);

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