Untitled
user_8555809
plain_text
a year ago
1.2 kB
4
Indexable
package ltts.com.controller; import ltts.com.model.Excel; import ltts.com.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController @CrossOrigin(origins="http://localhost:5173", allowedHeaders="*") public class AppController { @Autowired private UserService service; @PostMapping("/upload") public String UploadExcel(@RequestBody Excel excel) { if(service.uploadExcel(excel)) return "uploaded successfully"; return "failed to upload"; } @GetMapping("/show") public List<Excel> showAllExcel(){ return service.showAllExcel(); } @DeleteMapping("/delete/{id}") public String delete(@PathVariable("id") int id){ if(service.deleteById(id)) return "deleted successfully" ; return "failed to delete"; } { } }
Editor is loading...
Leave a Comment