package com.yh.saas.plugin.yiliangyiyun.controller;

import com.yh.saas.plugin.yiliangyiyun.entity.SearchRecordsInfo;
import com.yh.saas.plugin.yiliangyiyun.service.ISearchRecordsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.baomidou.mybatisplus.plugins.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 搜索记录 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-07-20
 */
@RestController
@RequestMapping("/searchRecordsInfo")
public class SearchRecordsInfoController {
    @Autowired
    private ISearchRecordsInfoService searchRecordsInfoService;
    /**
     * 新增搜索记录
     * @param searchRecordsInfo
     * @return
     */
    @PostMapping("/api/addInfo")
    public String addInfo(@RequestBody SearchRecordsInfo searchRecordsInfo) {
        return searchRecordsInfoService.addInfo(searchRecordsInfo);
    }

    /**
     * 搜索记录列表
     * @param searchRecordsInfo
     * @return
     */
    @GetMapping("/selectSearchRecordsInfo")
    public Page<SearchRecordsInfo> selectSearchRecordsInfo(SearchRecordsInfo searchRecordsInfo) {
        return searchRecordsInfoService.selectSearchRecordsInfo(searchRecordsInfo);

    }
    /**
     * 删除搜索记录
     * @param searchRecordsInfo
     */
    @PostMapping("/api/deleteSearchRecordsInfo")
    public void deleteSearchRecordsInfo (@RequestBody SearchRecordsInfo searchRecordsInfo){
        searchRecordsInfoService.deleteSearchRecordsInfo(searchRecordsInfo);
    }

    /**
     * 推荐搜索记录列表
     * @param searchRecordsInfo
     * @return
     */
    @GetMapping("/selectRecommendedSearchRecordsInfo")
    public Page<SearchRecordsInfo> selectRecommendedSearchRecordsInfo(SearchRecordsInfo searchRecordsInfo) {
        return searchRecordsInfoService.selectRecommendedSearchRecordsInfo(searchRecordsInfo);
    }
}

