001package ca.uhn.fhir.jpa.dao.data;
002
003import ca.uhn.fhir.jpa.entity.TermValueSetConceptView;
004import org.springframework.data.domain.PageRequest;
005import org.springframework.data.domain.Pageable;
006import org.springframework.data.jpa.repository.JpaRepository;
007import org.springframework.data.jpa.repository.Query;
008import org.springframework.data.repository.query.Param;
009
010import java.util.List;
011
012/*
013 * #%L
014 * HAPI FHIR JPA Server
015 * %%
016 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
017 * %%
018 * Licensed under the Apache License, Version 2.0 (the "License");
019 * you may not use this file except in compliance with the License.
020 * You may obtain a copy of the License at
021 *
022 *      http://www.apache.org/licenses/LICENSE-2.0
023 *
024 * Unless required by applicable law or agreed to in writing, software
025 * distributed under the License is distributed on an "AS IS" BASIS,
026 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
027 * See the License for the specific language governing permissions and
028 * limitations under the License.
029 * #L%
030 */
031
032public interface ITermValueSetConceptViewDao extends JpaRepository<TermValueSetConceptView, Long>, IHapiFhirJpaRepository {
033
034        @Query("SELECT v FROM TermValueSetConceptView v WHERE v.myConceptValueSetPid = :pid AND v.myConceptOrder >= :from AND v.myConceptOrder < :to ORDER BY v.myConceptOrder")
035        List<TermValueSetConceptView> findByTermValueSetId(@Param("from") int theFrom, @Param("to") int theTo, @Param("pid") Long theValueSetId);
036
037        @Query("SELECT v FROM TermValueSetConceptView v WHERE v.myConceptValueSetPid = :pid AND LOWER(v.myConceptDisplay) LIKE :display ORDER BY v.myConceptOrder")
038        List<TermValueSetConceptView> findByTermValueSetId(@Param("pid") Long theValueSetId, @Param("display") String theDisplay);
039
040}