修复存储功能
This commit is contained in:
parent
018bb31b68
commit
60506ba311
|
|
@ -0,0 +1,32 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mdd.common.aop.NotLogin;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.front.service.ISearchService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/search")
|
||||
@Api(tags = "搜索")
|
||||
public class SearchController {
|
||||
|
||||
|
||||
@Resource
|
||||
ISearchService iSearchService;
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/hotLists")
|
||||
@ApiOperation(value="搜索列表")
|
||||
public AjaxResult<JSONObject> hotLists() {
|
||||
JSONObject result = iSearchService.hotLists();
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.mdd.front.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 搜索接口类
|
||||
*/
|
||||
public interface ISearchService {
|
||||
|
||||
/**
|
||||
* 热搜
|
||||
*
|
||||
* @author fzr
|
||||
*/
|
||||
JSONObject hotLists();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.mdd.front.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.mdd.common.config.GlobalConfig;
|
||||
import com.mdd.common.entity.article.Article;
|
||||
import com.mdd.common.entity.decorate.DecoratePage;
|
||||
import com.mdd.common.entity.setting.HotSearch;
|
||||
import com.mdd.common.mapper.article.ArticleMapper;
|
||||
import com.mdd.common.mapper.decorate.DecoratePageMapper;
|
||||
import com.mdd.common.mapper.decorate.DecorateTabbarMapper;
|
||||
import com.mdd.common.mapper.setting.HotSearchMapper;
|
||||
import com.mdd.common.util.*;
|
||||
import com.mdd.front.service.IDecorateTabbarService;
|
||||
import com.mdd.front.service.IIndexService;
|
||||
import com.mdd.front.service.ISearchService;
|
||||
import com.mdd.front.vo.decorateTabbar.DecorateTabbarVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 首页服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class SearchServiceImpl implements ISearchService {
|
||||
|
||||
|
||||
@Resource
|
||||
HotSearchMapper hotSearchMapper;
|
||||
|
||||
@Override
|
||||
public JSONObject hotLists() {
|
||||
|
||||
List<HotSearch> hotSearches = hotSearchMapper.selectList(new QueryWrapper<>());
|
||||
JSONObject result = new JSONObject(){{
|
||||
put("status", ConfigUtils.get("hot_search", "status", "0"));
|
||||
put("data", hotSearches);
|
||||
}};
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue