SearchController.java 1.3 KB
Newer Older
张辰's avatar
张辰 committed
1 2 3 4 5 6 7 8
package com.tanpu.community.controller;

import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.common.auth.UserInfoHelper;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.qo.TopicDetailQo;
import com.tanpu.community.api.beans.req.search.ThemeFullSearchReq;
张辰's avatar
张辰 committed
9
import com.tanpu.community.api.beans.resp.ThemeFullSearchResp;
张辰's avatar
张辰 committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
import com.tanpu.community.manager.ThemeManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Slf4j
@RequestMapping(value = "/api/search")
public class SearchController {

    @Resource
    private UserHolder userHolder;

    @Autowired
    private ThemeManager themeManager;

    // 内容全文搜索
张辰's avatar
张辰 committed
31 32 33 34 35 36
    @ApiOperation("全文搜索主题")
    @PostMapping(value = "/themeFullText")
    @ResponseBody
    public CommonResp<ThemeFullSearchResp> themeFullText(@RequestBody ThemeFullSearchReq req) {
        ThemeFullSearchResp resp = themeManager.themeFullSearch(req.keyword, req.page.pageNumber, req.page.pageSize, req.excludeIds, userHolder.getUserId());
        return CommonResp.success(resp);
张辰's avatar
张辰 committed
37 38
    }

张辰's avatar
张辰 committed
39
}