Showing
1 changed file
with
0 additions
and
30 deletions
1 | -package com.esboot.bertsearch.controller; | ||
2 | - | ||
3 | -import com.esboot.bertsearch.dto.Phone; | ||
4 | -import com.esboot.bertsearch.repository.PhoneRepository; | ||
5 | -import org.elasticsearch.search.aggregations.metrics.InternalHDRPercentiles; | ||
6 | -import org.springframework.web.bind.annotation.GetMapping; | ||
7 | -import org.springframework.web.bind.annotation.PathVariable; | ||
8 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
9 | -import org.springframework.web.bind.annotation.RestController; | ||
10 | - | ||
11 | -@RestController | ||
12 | -@RequestMapping("/api") | ||
13 | -public class TestController { | ||
14 | - | ||
15 | - private final PhoneRepository phoneRepository; | ||
16 | - | ||
17 | - public TestController(PhoneRepository phoneRepository) { | ||
18 | - this.phoneRepository = phoneRepository; | ||
19 | - } | ||
20 | - | ||
21 | - @GetMapping("/phones") | ||
22 | - public Iterable<Phone> findAllPhones() { | ||
23 | - return phoneRepository.findAll(); | ||
24 | - } | ||
25 | - | ||
26 | - @GetMapping("/phones/{model}") | ||
27 | - public Iterable<Phone> findByModel(@PathVariable String model) { | ||
28 | - return phoneRepository.findByModel(model); | ||
29 | - } | ||
30 | -} |
-
Please register or login to post a comment