Open hainguyen201 opened 2 years ago
@PostMapping(value="/employee", headers="Content-Type=multipart/form-data") public ResponseEntity addEmployee(@RequestParam("employee") String employee, @RequestParam(value = "file", required = false) MultipartFile file){ return new ResponseEntity<>(HttpStatus.OK); // return new ResponseEntity<>(employeeRepository.save(employee), HttpStatus.OK); }
@PostMapping(value="/employee" ) public ResponseEntity addEmployee(@RequestParam(value = "employee") String employee, @RequestParam(value = "file") MultipartFile file){ ObjectMapper objectMapper = new ObjectMapper(); try { Employee employee1= objectMapper.readValue(employee, Employee.class); return new ResponseEntity<>(HttpStatus.OK); } catch (JsonProcessingException e) { e.printStackTrace(); return new ResponseEntity<>(HttpStatus.FORBIDDEN); }
// return new ResponseEntity<>(employeeRepository.save(employee), HttpStatus.OK); }
@PostMapping(value="/employee", headers="Content-Type=multipart/form-data") public ResponseEntity addEmployee(@RequestParam("employee") String employee, @RequestParam(value = "file", required = false) MultipartFile file){
return new ResponseEntity<>(HttpStatus.OK);
// return new ResponseEntity<>(employeeRepository.save(employee), HttpStatus.OK);
}