renew
This commit is contained in:
1
bin
Submodule
1
bin
Submodule
Submodule bin added at aa8d8275e8
23
src/main/java/co/jp/app/controller/DownloadController.java
Normal file
23
src/main/java/co/jp/app/controller/DownloadController.java
Normal 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
17
src/main/java/co/jp/app/repository/DownloadRepository.java
Normal file
17
src/main/java/co/jp/app/repository/DownloadRepository.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
18
src/main/java/co/jp/app/repository/userRepository.java
Normal file
18
src/main/java/co/jp/app/repository/userRepository.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package co.jp.app.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import co.jp.app.entity.UserEntity;
|
||||||
|
|
||||||
|
public interface userRepository extends JpaRepository<UserEntity, Integer> {
|
||||||
|
|
||||||
|
public default UserEntity getByName(@Param("name") String name) {
|
||||||
|
return getByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public default UserEntity getByEmail(@Param("email")String email) {
|
||||||
|
return getByEmail(email);
|
||||||
|
}
|
||||||
|
}
|
23
src/main/java/co/jp/app/service/DownloadService.java
Normal file
23
src/main/java/co/jp/app/service/DownloadService.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,23 +1,25 @@
|
|||||||
package co.jp.app.service;
|
package co.jp.app.service;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import co.jp.app.entity.UserEntity;
|
import co.jp.app.entity.UserEntity;
|
||||||
import co.jp.app.repository.UserRepository;
|
import co.jp.app.repository.userRepository;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserService {
|
public class UserService {
|
||||||
|
|
||||||
private final UserRepository userEntityRepository;
|
private final userRepository userEntityRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public UserService(UserRepository userEntityRepository, PasswordEncoder passwordEncoder ) {
|
public UserService(userRepository userEntityRepository, PasswordEncoder passwordEncoder )
|
||||||
|
{
|
||||||
this.userEntityRepository = userEntityRepository;
|
this.userEntityRepository = userEntityRepository;
|
||||||
this.passwordEncoder = passwordEncoder;
|
this.passwordEncoder= passwordEncoder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional // 整个注册过程应该是一个事务
|
@Transactional // 整个注册过程应该是一个事务
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#Generated by Maven Integration for Eclipse
|
#Generated by Maven Integration for Eclipse
|
||||||
#Wed May 07 16:32:03 JST 2025
|
#Mon May 12 11:48:07 JST 2025
|
||||||
m2e.projectLocation=C\:\\Users\\ichbi\\OneDrive\\\u30C7\u30B9\u30AF\u30C8\u30C3\u30D7\\dog-1
|
m2e.projectLocation=C\:\\Users\\ichbi\\OneDrive\\\u30C7\u30B9\u30AF\u30C8\u30C3\u30D7\\dog-1
|
||||||
m2e.projectName=dog-1
|
m2e.projectName=dog-1
|
||||||
groupId=co.jp.app
|
groupId=co.jp.app
|
||||||
|
@ -49,6 +49,10 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
Binary file not shown.
BIN
target/classes/co/jp/app/config/SecurityConfig.class
Normal file
BIN
target/classes/co/jp/app/config/SecurityConfig.class
Normal file
Binary file not shown.
BIN
target/classes/co/jp/app/controller/DownloadController.class
Normal file
BIN
target/classes/co/jp/app/controller/DownloadController.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/co/jp/app/repository/DownloadRepository.class
Normal file
BIN
target/classes/co/jp/app/repository/DownloadRepository.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/co/jp/app/service/DownloadService.class
Normal file
BIN
target/classes/co/jp/app/service/DownloadService.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user