首页>代码>Spring Boot整合VueJS+spring data jpa实现待办事项TODO项目实例>/springboot-todomvc-mysql-vuejs/src/main/java/com/hellokoding/springboot/fullstack/todo/TodoAPI.java
package com.hellokoding.springboot.fullstack.todo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController @RequestMapping("/api/v1/todos") @Slf4j public class TodoAPI { private final TodoService stockService; @Autowired public TodoAPI(TodoService stockService) { this.stockService = stockService; } @GetMapping public ResponseEntity<List<Todo>> findAll() { return ResponseEntity.ok(stockService.findAll()); } @PostMapping public ResponseEntity saveAll(@Valid @RequestBody List<Todo> todos) { log.info(todos.toString()); return ResponseEntity.ok(stockService.saveAll(todos)); } }
最近下载更多
nuxgod LV1
4月10日
asidun LV1
2022年12月29日
ajsfkl LV3
2022年8月19日
taoyi123 LV16
2021年3月25日
浙江螃蟹 LV7
2020年12月2日
zhangvsxun LV2
2020年12月1日
sunyongf LV3
2020年11月18日
ningmeng2020 LV2
2020年11月10日
sinbero LV8
2020年11月10日