|
|
|
@ -2,6 +2,7 @@ package com.example.demo; |
|
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PatchMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping; |
|
|
|
@ -54,6 +55,14 @@ public class Controller { |
|
|
|
|
return "ID "+id+" does not exist!"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@PatchMapping("/data/{id}") |
|
|
|
|
public Object _6(@PathVariable Long id,@RequestBody Data data) { |
|
|
|
|
if (database.existsById(id)) { |
|
|
|
|
return database.save(data); |
|
|
|
|
} else { |
|
|
|
|
return "ID "+id+" does not exist!"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@DeleteMapping("/data/{id}") |
|
|
|
|
public String _4(@PathVariable Long id) { |
|
|
|
|
if (database.existsById(id)) { |
|
|
|
|