changed format

This commit is contained in:
z
2025-05-12 11:50:08 +09:00
parent f335896f4f
commit 032424e7c6
24 changed files with 139 additions and 108 deletions

View File

@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import co.jp.app.service.PetService; import co.jp.app.service.PetService;
@Controller @Controller
public class PetController { public class PetController {
@ -19,7 +18,7 @@ public class PetController {
@GetMapping("/api/dogs/pet") @GetMapping("/api/dogs/pet")
public String getListByEntities(@RequestParam List<Integer> id) { public String getListByEntities(@RequestParam List<Integer> id) {
service.getPetByID(id); service.getPetByID(id);
return "pet"; return "pet";
} }
} }

View File

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

View File

@ -5,10 +5,11 @@ import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType; import jakarta.persistence.GenerationType;
import jakarta.persistence.Id; import jakarta.persistence.Id;
import jakarta.persistence.Table; import jakarta.persistence.Table;
@Entity @Entity
@Table(name = "Pet") @Table(name = "Pet")
public class PetEntity{ public class PetEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Id @Id
private int ID; private int ID;
@ -27,15 +28,15 @@ public class PetEntity{
//犬の健康状態 //犬の健康状態
private String status; private String status;
//犬の圖片 //犬の圖片
private String image; private String image;
public String getImage() {
return image;
}
public void setImage(String image) { public String getImage() {
this.image = image; return image;
} }
public void setImage(String image) {
this.image = image;
}
public String getName() { public String getName() {
return name; return name;
@ -92,6 +93,7 @@ public class PetEntity{
public void setStatus(String status) { public void setStatus(String status) {
this.status = status; this.status = status;
} }
public int getID() { public int getID() {
return ID; return ID;
} }
@ -99,5 +101,5 @@ public class PetEntity{
public void setID(int iD) { public void setID(int iD) {
ID = iD; ID = iD;
} }
} }

View File

@ -1,6 +1,5 @@
package co.jp.app.repository; package co.jp.app.repository;
import java.util.List; import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
@ -9,10 +8,8 @@ import co.jp.app.entity.PetEntity;
public interface PetRepository extends JpaRepository<PetEntity, Integer> { public interface PetRepository extends JpaRepository<PetEntity, Integer> {
@Override @Override
default List<PetEntity> findAllById(Iterable<Integer> id) { default List<PetEntity> findAllById(Iterable<Integer> id) {
return findAllById(id); return findAllById(id);
} }
} }

View File

@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
import co.jp.app.entity.PetEntity; import co.jp.app.entity.PetEntity;
import co.jp.app.repository.PetRepository; import co.jp.app.repository.PetRepository;
@Service @Service
public class PetService { public class PetService {
@Autowired @Autowired
@ -17,6 +16,6 @@ public class PetService {
public List<PetEntity> getPetByID(Iterable<Integer> id) { public List<PetEntity> getPetByID(Iterable<Integer> id) {
return dao.findAllById(id); return dao.findAllById(id);
} }
} }

1
target/classes/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/co/

View File

@ -1,6 +1,6 @@
#Generated by Maven Integration for Eclipse #Generated by Maven Integration for Eclipse
#Wed May 07 16:32:03 JST 2025 #Mon May 12 11:38:52 JST 2025
m2e.projectLocation=C\:\\Users\\ichbi\\OneDrive\\\u30C7\u30B9\u30AF\u30C8\u30C3\u30D7\\dog-1 m2e.projectLocation=E\:\\jugyo\\asciimg-master\\Dog-1
m2e.projectName=dog-1 m2e.projectName=dog-1
groupId=co.jp.app groupId=co.jp.app
artifactId=dog-2 artifactId=dog-2

View File

@ -1,87 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.5</version> <version>3.4.5</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>co.jp.app</groupId> <groupId>co.jp.app</groupId>
<artifactId>dog-2</artifactId> <artifactId>dog-2</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>dog-1</name> <name>dog-1</name>
<description>dog introduce project for Spring Boot</description> <description>dog introduce project for Spring Boot</description>
<url/> <url/>
<licenses> <licenses>
<license/> <license/>
</licenses> </licenses>
<developers> <developers>
<developer/> <developer/>
</developers> </developers>
<scm> <scm>
<connection/> <connection/>
<developerConnection/> <developerConnection/>
<tag/> <tag/>
<url/> <url/>
</scm> </scm>
<properties> <properties>
<java.version>17</java.version> <java.version>17</java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>jjwt-api</artifactId>
</dependency> <version>0.11.5</version>
<dependency> </dependency>
<groupId>com.mysql</groupId> <dependency>
<artifactId>mysql-connector-j</artifactId> <groupId>io.jsonwebtoken</groupId>
<scope>runtime</scope> <artifactId>jjwt-impl</artifactId>
</dependency> <version>0.11.5</version>
<dependency> <scope>runtime</scope>
<groupId>org.springframework.boot</groupId> </dependency>
<artifactId>spring-boot-starter-test</artifactId> <dependency>
<scope>test</scope> <groupId>io.jsonwebtoken</groupId>
</dependency> <artifactId>jjwt-jackson</artifactId>
<dependency> <version>0.11.5</version>
<groupId>com.fasterxml.jackson.core</groupId> <scope>runtime</scope>
<artifactId>jackson-databind</artifactId> </dependency>
</dependency> <dependency>
</dependencies> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<annotationProcessorPaths> <annotationProcessorPaths>
<path> <path>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</path> </path>
</annotationProcessorPaths> </annotationProcessorPaths>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<excludes> <excludes>
<exclude> <exclude>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</exclude> </exclude>
</excludes> </excludes>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -7,4 +7,7 @@ spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.datasource.url=jdbc:mysql://192.168.1.192:3306/dog spring.datasource.url=jdbc:mysql://192.168.1.192:3306/dog
spring.datasource.username=coder spring.datasource.username=coder
spring.datasource.password=coder spring.datasource.password=coder
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
jwt.secret=wM7Pz4BxvZ5NcLaBpgJm0eRQ5ztc3W5+OPH0E7g3gcQ=
jwt.token-expiration-ms==900000