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