forked from kidgrow-microservices-platform

zhaoxiaohao
2020-07-10 1e0ed9d181d1c877d635f8f9b2b5a25a6b6f078f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.kidgrow.searchcenter.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.kidgrow.common.model.*;
 
import com.kidgrow.searchcenter.model.SearchDto;
import com.kidgrow.searchcenter.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
 
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @Description: 通用搜索<br>
 * @Project: <br>
 * @CreateDate: Created in 2020/2/24 13:47 <br>
 * @Author: <a href="4345453@kidgrow.com">liuke</a>
 */
@Slf4j
@RestController
@Api(tags = "搜索模块api")
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private ISearchService searchService;
 
    /**
     * 查询文档列表
     * @param indexName 索引名
     * @param searchDto 搜索Dto
     */
    @PostMapping("/{indexName}")
    public PageResult<JSONObject> strQuery(@PathVariable String indexName, @RequestBody(required = false) SearchDto searchDto) {
        if (searchDto == null) {
            searchDto = new SearchDto();
        }
        return searchService.strQuery(indexName, searchDto);
    }
}