| | |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | |
| | | return R.ok(new PageResult().setRecords(matnrPage.getRecords()).setTotal(matnrPage.getTotal())); |
| | | } |
| | | |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @PostMapping("/matnr/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(matnrService.list(), Matnr.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:save')") |
| | | @ApiOperation(value = "excel表格导入物料信息") |
| | | @PostMapping("/matnr/import") |
| | | public R listImport(@RequestParam MultipartFile file) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | throw new CoolException("文件不能为空!!"); |
| | | } |
| | | matnrService.importExcels(file); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |