ESCourseController.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package com.futu.course.es.controller;
  2. import com.futu.course.es.Service.impl.ESCourseService;
  3. import com.futu.course.es.domain.ESCourse;
  4. import com.futu.course.es.domain.MongoDBCourse;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.*;
  7. import java.io.IOException;
  8. import java.util.ArrayList;
  9. import java.util.HashSet;
  10. import java.util.List;
  11. /**
  12. * @author "杨旭朋"
  13. * @ClassName: ESCourseController
  14. * @date 2025年05月06日 15:54
  15. */
  16. @RestController
  17. @RequestMapping("/EsCourse")
  18. public class ESCourseController {
  19. @Autowired
  20. ESCourseService esCourseService;
  21. @PostMapping("/search")
  22. public ArrayList<String> search(@RequestParam("name") String name) throws IOException {
  23. return esCourseService.search(name);
  24. }
  25. @GetMapping("/MysqlInterES")
  26. public void MysqlInterES() throws IOException {
  27. esCourseService.MysqlInterES();
  28. }
  29. @PostMapping("/CourseList")
  30. public HashSet<ESCourse> CourseList(@RequestParam("categoryId") int categoryId) throws IOException {
  31. return esCourseService.CourseList(categoryId);
  32. }
  33. @PostMapping("/SelCourse")
  34. public HashSet<ESCourse> SelCourse(@RequestParam("name") String name) throws IOException {
  35. return esCourseService.SelCourse(name);
  36. }
  37. @GetMapping("checkAndCreateIndex")
  38. public boolean checkAndCreateIndex() throws IOException {
  39. return esCourseService.checkAndCreateIndex();
  40. }
  41. @GetMapping("/searchLogs")
  42. public List<MongoDBCourse> searchLogs(){
  43. return esCourseService.searchLogs();
  44. }
  45. }