package com.viettel.campaign.repository;

import com.viettel.campaign.model.ApParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ApParamRepository extends JpaRepository<ApParam, Long>, ApParamRepositoryCustom {

    Page<ApParam> findAll(Pageable pageable);

    @Query(value = "SELECT p FROM ApParam p WHERE parName LIKE concat('%', :parName, '%') ")
    List<ApParam> findParamByName(@Param("parName") String parName, Pageable pageable);
}
