1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package com.pavis.app.saasbacken.dao;
- import com.pavis.app.saasbacken.entity.ResourceLibraryEntity;
- import org.springframework.data.elasticsearch.annotations.Query;
- import org.springframework.data.elasticsearch.core.SearchHits;
- import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
- import org.springframework.data.repository.query.Param;
- import org.springframework.stereotype.Repository;
- import java.awt.print.Pageable;
- import java.util.List;
- import java.util.Map;
- @Repository
- // public interface ResourceLibraryEntityMapper extends ElasticsearchRepository<ResourceLibraryEntity, String> {
- public interface ResourceLibraryEntityMapper extends ElasticsearchRepository<ResourceLibraryEntity, String> {
- List<ResourceLibraryEntity> findByName(String name);
- // List<ResourceLibraryEntity> findByUniqueId();
- List<ResourceLibraryEntity> findByRegisterAddress(String address);
- @Query("{ \"bool\" : { \"must\" : { \"term\" : { \"softwareCopyrightCount\" : 2 } } } }")
- List<ResourceLibraryEntity> findByFlag();
- // List<ResourceLibraryEntity> findByAnnualRevenue();
- @Query("{\"bool\": {\"must\": [{\"nested\": {\"path\": \"annualRevenue\",\"query\": {\"bool\": {\n" +
- " \"must\": [{\"match\": {\"annualRevenue.year\": \"2019\"}}],\n" +
- " \"filter\":{\"script\":{\"script\":{\"source\":\"73 <= doc['annualRevenue.val'].value && doc['annualRevenue.val'].value < 75\"}}}}}}}]}}")
- SearchHits sel(Map<String, Object> param);
- @Query("{\"bool\": {\"must\": [{\"nested\": {\"path\": \"annualRevenue\",\"query\": {\"bool\": {\n" +
- " \"must\": [{\"match\": {\"annualRevenue.year\": \"?0\"}}],\n" +
- " \"filter\":{\"script\":{\"script\":{\"source\":\"73 <= doc['annualRevenue.val'].value && doc['annualRevenue.val'].value < 75\"}}}}}}}]}}")
- SearchHits sels(String year);
- @Query("{\"bool\": {\"must\": [{\"nested\": {\"path\": \"annualRevenue\",\"query\": {\"bool\": {\n" +
- " \"must\": [{\"match\": {\"annualRevenue.year\": \"{param}.year\"}}],\n" +
- " \"filter\":{\"script\":{\"script\":{\"source\":\"73 <= doc['annualRevenue.val'].value && doc['annualRevenue.val'].value < 75\"}}}}}}}]}}")
- SearchHits selss(@Param("param") Map<String, String> param);
- @Query("{\"bool\": {\"must\": [{\"nested\": {\"path\": \"annualRevenue\",\"query\": {\"bool\": {\"must\": \n" +
- "[{\"match\": {\"annualRevenue.year\": \"2019\"}},\n" +
- "{\"range\":{\"annualRevenue.val\":{\"gte\":23,\"lte\":120}}}\n" +
- "]}}}}]}}")
- SearchHits selsss(@Param("param") Map<String, String> param);
- @Query("{\"match\": {\"name\": {\"query\": \"?0\"}}}")
- // Page<Book> findByName(String name, Pageable pageable);
- SearchHits findByName(String name, Pageable pageable);
- }
|