PublicScreenChatController.java 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.izouma.nineth.web;
  2. import com.izouma.nineth.domain.PublicScreenChat;
  3. import com.izouma.nineth.dto.PageQuery;
  4. import com.izouma.nineth.repo.PublicScreenChatRepo;
  5. import com.izouma.nineth.service.PublicScreenChatService;
  6. import com.izouma.nineth.utils.excel.ExcelUtils;
  7. import lombok.AllArgsConstructor;
  8. import org.springframework.data.domain.Page;
  9. import org.springframework.web.bind.annotation.*;
  10. import javax.servlet.http.HttpServletResponse;
  11. import java.io.IOException;
  12. import java.util.List;
  13. @RestController
  14. @RequestMapping("/publicScreenChat")
  15. @AllArgsConstructor
  16. public class PublicScreenChatController extends BaseController {
  17. private PublicScreenChatService publicScreenChatService;
  18. private PublicScreenChatRepo publicScreenChatRepo;
  19. //@PreAuthorize("hasRole('ADMIN')")
  20. @PostMapping("/all")
  21. public Page<PublicScreenChat> all(@RequestBody PageQuery pageQuery) {
  22. return publicScreenChatService.all(pageQuery);
  23. }
  24. @GetMapping("/excel")
  25. @ResponseBody
  26. public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
  27. List<PublicScreenChat> data = all(pageQuery).getContent();
  28. ExcelUtils.export(response, data);
  29. }
  30. @PostMapping("/recall/{id}")
  31. public void recall(@PathVariable Long id) {
  32. publicScreenChatRepo.recall(id);
  33. }
  34. }