ESCourseController.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.*;
  6. import java.io.IOException;
  7. import java.util.ArrayList;
  8. import java.util.HashSet;
  9. /**
  10. * @author "杨旭朋"
  11. * @ClassName: ESCourseController
  12. * @date 2025年05月06日 15:54
  13. */
  14. @RestController
  15. @RequestMapping("/EsCourse")
  16. public class ESCourseController {
  17. @Autowired
  18. ESCourseService esCourseService;
  19. @PostMapping("/search")
  20. public ArrayList<String> search(@RequestBody SearchDto dto) throws IOException {
  21. System.out.println(dto.getName());
  22. return esCourseService.search(dto.getName());
  23. }
  24. @GetMapping("/MysqlInterES")
  25. public void MysqlInterES() throws IOException {
  26. esCourseService.MysqlInterES();
  27. }
  28. @PostMapping("/CourseList")
  29. public HashSet<ESCourse> CourseList(@RequestBody CourseDto courseDto) throws IOException {
  30. System.out.println("categoryId:"+courseDto.getCategoryId());
  31. return esCourseService.CourseList(courseDto.getCategoryId());
  32. }
  33. @PostMapping("/SelCourse")
  34. public HashSet<ESCourse> SelCourse(@RequestBody SearchDto dto) throws IOException {
  35. System.out.println(dto.getName());
  36. return esCourseService.SelCourse(dto.getName());
  37. }
  38. @GetMapping("checkAndCreateIndex")
  39. public boolean checkAndCreateIndex() throws IOException {
  40. return esCourseService.checkAndCreateIndex();
  41. }
  42. @GetMapping("/searchLogs")
  43. public List<MongoDBCourse> searchLogs(){
  44. return esCourseService.searchLogs();
  45. }
  46. }