Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import co.jp.app.service.PetService;
|
||||
|
||||
|
||||
@Controller
|
||||
|
||||
public class PetController {
|
||||
@ -19,7 +18,7 @@ public class PetController {
|
||||
|
||||
@GetMapping("/api/dogs/pet")
|
||||
public String getListByEntities(@RequestParam List<Integer> id) {
|
||||
service.getPetByID(id);
|
||||
service.getPetByID(id);
|
||||
return "pet";
|
||||
}
|
||||
}
|
||||
|
@ -9,20 +9,19 @@ 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.saveAll(list);
|
||||
|
||||
return "upload";
|
||||
|
||||
|
@ -5,10 +5,11 @@ import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Pet")
|
||||
public class PetEntity{
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
public class PetEntity {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
||||
@Id
|
||||
private int ID;
|
||||
@ -27,15 +28,15 @@ public class PetEntity{
|
||||
//犬の健康状態
|
||||
private String status;
|
||||
//犬の圖片
|
||||
private String image;
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
private String image;
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@ -92,6 +93,7 @@ public class PetEntity{
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
@ -99,5 +101,5 @@ public class PetEntity{
|
||||
public void setID(int iD) {
|
||||
ID = iD;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package co.jp.app.repository;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@ -9,10 +8,8 @@ import co.jp.app.entity.PetEntity;
|
||||
|
||||
public interface PetRepository extends JpaRepository<PetEntity, Integer> {
|
||||
|
||||
@Override
|
||||
default List<PetEntity> findAllById(Iterable<Integer> id) {
|
||||
return findAllById(id);
|
||||
@Override
|
||||
default List<PetEntity> findAllById(Iterable<Integer> id) {
|
||||
return findAllById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
|
||||
import co.jp.app.entity.PetEntity;
|
||||
import co.jp.app.repository.PetRepository;
|
||||
|
||||
|
||||
@Service
|
||||
public class PetService {
|
||||
@Autowired
|
||||
@ -17,6 +16,6 @@ public class PetService {
|
||||
public List<PetEntity> getPetByID(Iterable<Integer> id) {
|
||||
|
||||
return dao.findAllById(id);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user