0512修正

This commit is contained in:
2025-05-12 15:09:01 +09:00
parent 9ea0721375
commit e307eb06cc
10 changed files with 37 additions and 2 deletions

View File

@ -9,19 +9,20 @@ import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import co.jp.app.entity.PetEntity;
import co.jp.app.service.UploadService;
@CrossOrigin("http://192.168.1.50:5173")
@Controller
public class UploadController {
@Autowired
//private UploadService service;
private UploadService service;
@PostMapping("/api/dogs/upload")
public String upload() {
List<PetEntity> list = new ArrayList<PetEntity>();
//service.saveAll(list);
service.saveAllPets(list);
return "upload";

View File

@ -0,0 +1,21 @@
package co.jp.app.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import co.jp.app.entity.PetEntity;
import co.jp.app.repository.UploadRepository;
@Service
public class UploadService {
@Autowired
private UploadRepository uploadDao;
public List<PetEntity> saveAllPets(List<PetEntity> entities) {
return uploadDao.saveAll(entities);
}
}