package com.viettel.campaign.repository;

import com.viettel.campaign.model.CampaignCompleteCode;
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 CampaignCompleteCodeRepository extends JpaRepository<CampaignCompleteCode, Long> {

    Page<CampaignCompleteCode> findAll(Pageable pageable);

    @Query("FROM CampaignCompleteCode WHERE completeName LIKE concat('%', :name, '%') ")
    List<CampaignCompleteCode> findByName(@Param("name") String Name, Pageable pageable);

    List<CampaignCompleteCode> findByCompleteNameContains(String Name, Pageable pageable);
}
