除了查询内容外,我还需要查看实体“ Terreno0101”的“ entorno”字段。我了解api的价值在于环境。
@RequestMapping(value = "/_search/terreno-0101-s",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Transactional(readOnly = true)
public ResponseEntity<List<Terreno0101DTO>> searchTerreno0101S(@RequestParam Map<String,String> requestParams, Pageable pageable)
throws URISyntaxException {
String query = requestParams.get("query");
String entorno = requestParams.get("entorno");
log.debug("REST request to search for a page of Terreno0101S for query {}", query);
Page<Terreno0101> page = terreno0101Service.search(requestParams.get("query"), pageable);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/terreno-0101-s");
return new ResponseEntity<>(terreno0101Mapper.terreno0101SToTerreno0101DTOs(page.getContent()), headers, HttpStatus.OK);
}
服务
@Transactional(readOnly = true)
public Page<Terreno0101> search(String query, Pageable pageable) {
log.debug("Request to search for a page of Terreno0101S for query {}", query);
return terreno0101SearchRepository.search(queryStringQuery(query), pageable);
}
仓库
public interface Terreno0101SearchRepository extends ElasticsearchRepository<Terreno0101, Long> {
}
但不作为添加到我的服务和/或存储库中的原因,因为仅查找那些符合查询条件的内容,并且“ entorno”是吸引我的字段。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句