| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @PostMapping("/addition") |
| | | @ApiOperation("添加") |
| | | @LogSave(operationType = "卡口管理",contain = "添加卡口") |
| | | @LogSave(operationType = "卡口管理", contain = "添加卡口") |
| | | public CommonResult add(@RequestBody EquipmentBayonet equipmentBayonet) { |
| | | return CommonResult.success(iEquipmentBayonetService.save(equipmentBayonet)); |
| | | } |
| | | |
| | | @PutMapping("/modification") |
| | | @ApiOperation("修改") |
| | | @LogSave(operationType = "卡口管理",contain = "修改卡口") |
| | | @LogSave(operationType = "卡口管理", contain = "修改卡口") |
| | | public CommonResult modify(@RequestBody EquipmentBayonet equipmentBayonet) { |
| | | return CommonResult.success(iEquipmentBayonetService.updateById(equipmentBayonet)); |
| | | } |
| | |
| | | @GetMapping("/export") |
| | | @ApiOperation("导出") |
| | | @SneakyThrows |
| | | @LogSave(operationType = "卡口管理",contain = "删除卡口") |
| | | @LogSave(operationType = "卡口管理", contain = "删除卡口") |
| | | public void export(HttpServletResponse response, |
| | | @RequestParam(required = false) Integer size, |
| | | @RequestParam(required = false) Integer current, |
| | |
| | | Page<EquipmentBayonet> equipmentBayonetPage = new Page<>(); |
| | | equipmentBayonetPage.setCurrent(current); |
| | | equipmentBayonetPage.setSize(size); |
| | | String fileName ="卡口数据"; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + URLEncoder.encode(fileName + ".xlsx", "utf-8")); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), EquipmentBayonetVO.class) |
| | | .sheet("数据") |
| | | .doWrite(iEquipmentBayonetService |