package com.izouma.nineth.web; import com.izouma.nineth.domain.PublicScreenChat; import com.izouma.nineth.dto.PageQuery; import com.izouma.nineth.repo.PublicScreenChatRepo; import com.izouma.nineth.service.PublicScreenChatService; import com.izouma.nineth.utils.excel.ExcelUtils; import lombok.AllArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @RestController @RequestMapping("/publicScreenChat") @AllArgsConstructor public class PublicScreenChatController extends BaseController { private PublicScreenChatService publicScreenChatService; private PublicScreenChatRepo publicScreenChatRepo; //@PreAuthorize("hasRole('ADMIN')") @PostMapping("/all") public Page all(@RequestBody PageQuery pageQuery) { return publicScreenChatService.all(pageQuery); } @GetMapping("/excel") @ResponseBody public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException { List data = all(pageQuery).getContent(); ExcelUtils.export(response, data); } @PostMapping("/recall/{id}") public void recall(@PathVariable Long id) { publicScreenChatRepo.recall(id); } }