34 lines
908 B
Java
34 lines
908 B
Java
package com.example.springdemo.controller;
|
|
|
|
import com.example.springdemo.entities.Indent;
|
|
import com.example.springdemo.service.IndentService;
|
|
import jakarta.annotation.Resource;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@RestController
|
|
@RequestMapping("/indent")
|
|
public class IndentController {
|
|
@Resource
|
|
private IndentService indentService;
|
|
|
|
@PostMapping("/add")
|
|
public Indent addIndent(@RequestBody Indent indent) {
|
|
return indentService.addIndent(indent);
|
|
}
|
|
|
|
@DeleteMapping("/delete/{id}")
|
|
public void deleteIndent(@PathVariable Long id) {
|
|
indentService.deleteIndentById(id);
|
|
}
|
|
|
|
@PutMapping("/update")
|
|
public Indent updateIndent(@RequestBody Indent indent) {
|
|
return indentService.updateIndent(indent);
|
|
}
|
|
|
|
@GetMapping("/find")
|
|
public Iterable<Indent> getIndent() {
|
|
return indentService.findAllIndents();
|
|
}
|
|
}
|