File tree 2 files changed +70
-5
lines changed
spring-data-elasticsearch-crud/src/main/java/org/spring/springboot
2 files changed +70
-5
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
public interface CityRepository extends ElasticsearchRepository <City , Long > {
17
17
/**
18
+ * AND 语句查询
19
+ *
18
20
* @param description
19
21
* @param score
20
22
* @return
21
23
*/
22
24
List <City > findByDescriptionAndScore (String description , Integer score );
23
25
26
+ /**
27
+ * OR 语句查询
28
+ *
29
+ * @param description
30
+ * @param score
31
+ * @return
32
+ */
24
33
List <City > findByDescriptionOrScore (String description , Integer score );
25
34
35
+ /**
36
+ * 查询城市描述
37
+ *
38
+ * 等同于下面代码
39
+ * @Query("{\"bool\" : {\"must\" : {\"term\" : {\"description\" : \"?0\"}}}}")
40
+ * Page<City> findByDescription(String description, Pageable pageable);
41
+ *
42
+ * @param description
43
+ * @param page
44
+ * @return
45
+ */
26
46
Page <City > findByDescription (String description , Pageable page );
27
47
28
- // @Query("{\"bool\" : {\"must\" : {\"term\" : {\"description\" : \"?0\"}}}}")
29
- // Page<City> findByDescription(String description, Pageable pageable);
30
-
48
+ /**
49
+ * NOT 语句查询
50
+ *
51
+ * @param description
52
+ * @param page
53
+ * @return
54
+ */
31
55
Page <City > findByDescriptionNot (String description , Pageable page );
32
56
57
+ /**
58
+ * LIKE 语句查询
59
+ *
60
+ * @param description
61
+ * @param page
62
+ * @return
63
+ */
33
64
Page <City > findByDescriptionLike (String description , Pageable page );
34
65
35
- Page <City > findByScoreBetween (Integer score , Pageable page );
36
-
37
66
}
Original file line number Diff line number Diff line change 5
5
6
6
import java .util .List ;
7
7
8
+ /**
9
+ * 城市 ES 业务接口类
10
+ *
11
+ */
8
12
public interface CityService {
9
13
10
14
/**
@@ -15,13 +19,45 @@ public interface CityService {
15
19
*/
16
20
Long saveCity (City city );
17
21
22
+ /**
23
+ * AND 语句查询
24
+ *
25
+ * @param description
26
+ * @param score
27
+ * @return
28
+ */
18
29
List <City > findByDescriptionAndScore (String description , Integer score );
19
30
31
+ /**
32
+ * OR 语句查询
33
+ *
34
+ * @param description
35
+ * @param score
36
+ * @return
37
+ */
20
38
List <City > findByDescriptionOrScore (String description , Integer score );
21
39
40
+ /**
41
+ * 查询城市描述
42
+ *
43
+ * @param description
44
+ * @return
45
+ */
22
46
List <City > findByDescription (String description );
23
47
48
+ /**
49
+ * NOT 语句查询
50
+ *
51
+ * @param description
52
+ * @return
53
+ */
24
54
List <City > findByDescriptionNot (String description );
25
55
56
+ /**
57
+ * LIKE 语句查询
58
+ *
59
+ * @param description
60
+ * @return
61
+ */
26
62
List <City > findByDescriptionLike (String description );
27
63
}
You can’t perform that action at this time.
0 commit comments