package com.crm.manager.dao.repository;

import com.crm.rely.backend.core.pojo.table.SysIpLimitTable;
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 SysIpLimitRepository extends BaseRepository<SysIpLimitTable> {

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

    SysIpLimitTable getFirstById(Long id);

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

    List<SysIpLimitTable> getAllByIdIsNotNull();

    boolean existsByIp(String ip);
}
