补全注释
This commit is contained in:
@@ -50,8 +50,10 @@ public class QueryBookController {
|
|||||||
@RequestParam(name = "gt_word_count", defaultValue = "0") int gtWordCount,
|
@RequestParam(name = "gt_word_count", defaultValue = "0") int gtWordCount,
|
||||||
@RequestParam(name = "lt_word_count", required = false) Integer ltWordCount) {
|
@RequestParam(name = "lt_word_count", required = false) Integer ltWordCount) {
|
||||||
String type = "novel";
|
String type = "novel";
|
||||||
|
// 构造布尔查询
|
||||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||||
|
|
||||||
|
// 根据传入的字段构造查询体
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
boolQuery.must(QueryBuilders.matchQuery("author", author));
|
boolQuery.must(QueryBuilders.matchQuery("author", author));
|
||||||
}
|
}
|
||||||
@@ -60,10 +62,13 @@ public class QueryBookController {
|
|||||||
boolQuery.must(QueryBuilders.matchQuery("title", title));
|
boolQuery.must(QueryBuilders.matchQuery("title", title));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 构造范围查询
|
||||||
RangeQueryBuilder rangeQuery = QueryBuilders.rangeQuery("word_count").from(gtWordCount);
|
RangeQueryBuilder rangeQuery = QueryBuilders.rangeQuery("word_count").from(gtWordCount);
|
||||||
|
|
||||||
if (ltWordCount != null && ltWordCount > 0) {
|
if (ltWordCount != null && ltWordCount > 0) {
|
||||||
rangeQuery.to(ltWordCount);
|
rangeQuery.to(ltWordCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加入filter中
|
// 加入filter中
|
||||||
boolQuery.filter(rangeQuery);
|
boolQuery.filter(rangeQuery);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ public class UpdateBookController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TransportClient client;
|
private TransportClient client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param title
|
||||||
|
* @param author
|
||||||
|
* @param wordCount
|
||||||
|
* @param publishDate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PutMapping("/novel")
|
@PutMapping("/novel")
|
||||||
public ResponseEntity update(@RequestParam(name = "id") String id,
|
public ResponseEntity update(@RequestParam(name = "id") String id,
|
||||||
@RequestParam(name = "title", required = false) String title,
|
@RequestParam(name = "title", required = false) String title,
|
||||||
|
|||||||
Reference in New Issue
Block a user