Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-05-12 15:58:55 +09:00
28 changed files with 113 additions and 6 deletions

View File

@ -0,0 +1,23 @@
package co.jp.app.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import co.jp.app.service.PetService;
@Controller
public class DownloadController {
@Autowired
private PetService service;
@GetMapping("/api/dogs/pet")
public String downloadById(@RequestParam List<Integer> id) {
service.getPetByID(id);
return "pet";
}
}

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,17 @@
package co.jp.app.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import co.jp.app.entity.PetEntity;
public interface DownloadRepository extends JpaRepository<PetEntity, Integer>{
@Override
default List<PetEntity> findAllById(Iterable<Integer> id) {
return findAllById(id);
}
}

View File

@ -0,0 +1,23 @@
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.DownloadRepository;
@Service
public class DownloadService {
@Autowired
private DownloadRepository downloadDao;
public List<PetEntity> getPetByID(Iterable<Integer> id) {
return downloadDao.findAllById(id);
}
}

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);
}
}

View File

@ -1,5 +1,15 @@
package co.jp.app.service;
<<<<<<< HEAD
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import co.jp.app.entity.UserEntity;
import co.jp.app.repository.userRepository;
import jakarta.transaction.Transactional;
=======
import java.util.Collection;
import java.util.Collections;
@ -17,16 +27,28 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
>>>>>>> 34de018ef0606dec4f6de48c8cc5c3f073a1fdc6
@Service
public class UserService implements UserDetailsService {
<<<<<<< HEAD
private final userRepository userEntityRepository;
@Autowired
public UserService(userRepository userEntityRepository, PasswordEncoder passwordEncoder )
{
this.userEntityRepository = userEntityRepository;
this.passwordEncoder= passwordEncoder;
=======
private final UserRepository userRepository;
private final PasswordEncoder passwordEncoder;
public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
>>>>>>> 34de018ef0606dec4f6de48c8cc5c3f073a1fdc6
}
@Transactional