package com.agent.management.repository;

import com.agent.management.model.entity.SqlQueryHistory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SqlQueryHistoryRepository extends JpaRepository<SqlQueryHistory, Long> {

    Page<SqlQueryHistory> findByDatasourceIdOrderByExecutedAtDesc(Long datasourceId, Pageable pageable);

    List<SqlQueryHistory> findTop10ByDatasourceIdOrderByExecutedAtDesc(Long datasourceId);

    void deleteByDatasourceId(Long datasourceId);
}
