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