TweetController.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.launch.api.mysql.controller;
  2. import com.launch.api.elasticSearch.entity.Index1;
  3. import com.launch.api.elasticSearch.entity.Index2;
  4. import com.launch.api.elasticSearch.service.TweeTEsService;
  5. import com.launch.api.mysql.entity.test.Tweet;
  6. import com.launch.api.mysql.service.test.TweetService;
  7. import jakarta.annotation.Resource;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import reactor.core.publisher.Flux;
  12. import reactor.core.publisher.Mono;
  13. @RestController
  14. @RequestMapping("tweet")
  15. public class TweetController {
  16. @Resource
  17. private TweeTEsService repository;
  18. @Resource
  19. private TweetService tweetService;
  20. @GetMapping("getAll")
  21. public Flux<Tweet> getAll(){
  22. return tweetService.getAll();
  23. }
  24. @GetMapping("saveEs")
  25. public Mono<Index1> saveEs(){
  26. Index1 index1 = new Index1(1l,"xiao");
  27. return repository.mySave(index1);
  28. }
  29. @GetMapping("getEs")
  30. public Mono<Index2> getEs(){
  31. return repository.get();
  32. }
  33. }