| package org.eclipse.openk.contactbasedata.repository; |
| |
| import org.eclipse.openk.contactbasedata.model.VwDetailedContact; |
| import org.springframework.data.domain.Page; |
| import org.springframework.data.domain.Pageable; |
| import org.springframework.data.jpa.repository.Query; |
| import org.springframework.data.repository.PagingAndSortingRepository; |
| import org.springframework.data.repository.query.Param; |
| |
| import java.util.UUID; |
| |
| public interface DetailedContactRepository extends PagingAndSortingRepository<VwDetailedContact, Long> { |
| Page<VwDetailedContact> findAll(Pageable pageable); |
| |
| |
| @Query( "select dc from VwDetailedContact dc where" |
| + "(COALESCE(:contactType) is null or COALESCE(:contactType) is not null AND dc.contactType=:contactType)" |
| + " and (COALESCE(:personType) is null or COALESCE(:personType) is not null AND dc.personTypeUuid=:personType)" |
| + " and (COALESCE(:searchText) is null or COALESCE(:searchText) is not null AND dc.searchfield like %:searchText%)") |
| Page<VwDetailedContact> findByFilter(@Param("contactType")String contactType, |
| @Param("personType") UUID personType, |
| @Param("searchText") String searchText, |
| Pageable pageable); |
| } |