导出excel

This commit is contained in:
cyk
2023-12-22 19:49:24 +08:00
parent b30162391d
commit cc5276705d
8 changed files with 270 additions and 13 deletions

View File

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@@ -42,6 +43,7 @@ public class SearchController {
redisService.addSearchHistoryByUserId(userId, searchKey);
redisService.incrementScoreByUserId(searchKey);
redisService.incrementScore(searchKey);
//返回网站数据
@@ -67,15 +69,41 @@ public class SearchController {
@RequestMapping("/getSearchHistoryByUserId")
public String getSearchHistoryByUserId(String userId)
{
String res = "123";
return res;
List<String> stringList = redisService.getSearchHistoryByUserId(userId);
HashMap<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("msg", "查询成功");
result.put("data",stringList);
String jsonString = JSONObject.toJSONString(result);
return jsonString;
}
/**
* 删除个人历史数据
*/
@RequestMapping("/delSearchHistoryByUserId")
public String delSearchHistoryByUserId(String userId, String searchKey){
String res = "123";
return res;
Long f = redisService.delSearchHistoryByUserId(userId,searchKey);
HashMap<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("msg", "删除结果");
result.put("data",f);
String jsonString = JSONObject.toJSONString(result);
return jsonString;
}
/**
* 根据searchKey搜索其相关最热的前十名 (如果searchKey为null空则返回redis存储的前十最热词条)
*/
@RequestMapping("/getHotList")
public String getHotList(String searchKey){
List<String> stringList = redisService.getHotList(searchKey);
HashMap<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("msg", "查询结果");
result.put("data",stringList);
String jsonString = JSONObject.toJSONString(result);
return jsonString;
}
}