package com.crm.manager.dao.repository;

import com.crm.rely.backend.core.dto.country.SysCountryDto;
import com.crm.rely.backend.core.pojo.table.SysBankTable;
import com.crm.rely.backend.core.pojo.table.SysCountryTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
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 SysCountryRepository extends JpaRepository<SysCountryTable, Long>,JpaSpecificationExecutor<SysCountryTable> {

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

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

    SysCountryTable getByCode(String code);
}
