| | |
| | | .doWrite(data); |
| | | } |
| | | |
| | | @PostMapping("/question/export") |
| | | public void importQuestion(QuestionPageRequestVM query, HttpServletResponse response) throws IOException { |
| | | // 查询导出数据 |
| | | List<QuestionImportVO> exportData = questionService.export(query); |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | String fileName = URLEncoder.encode("题目导出数据", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), QuestionImportVO.class).sheet("题目导出数据").doWrite(exportData); |
| | | } |
| | | |
| | | /** |
| | | * 题目导入 |
| | | * |