From 16348b3fabe453a15aede3d1501c442bff74fad7 Mon Sep 17 00:00:00 2001 From: Anna-Jin Date: Mon, 11 Jul 2022 13:40:49 +0900 Subject: [PATCH] =?UTF-8?q?#19=20[Create]=20=EC=97=85=EC=9E=A5=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit entity 및 dto 생성 --- .../store/domain/UserRegisterStore.java | 40 ++++++++++++++++--- .../userRegisterStoreRequestDto.java | 4 ++ .../userRegisterStoreResponseDto.java | 15 +++++++ .../store/repository/StoreRepository.java | 2 + .../mpnp/baechelin/user/entity/user/User.java | 8 ++++ 5 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreRequestDto.java create mode 100644 src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreResponseDto.java diff --git a/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java b/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java index ff2f299..29b9b2d 100644 --- a/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java +++ b/src/main/java/com/mpnp/baechelin/store/domain/UserRegisterStore.java @@ -1,13 +1,11 @@ package com.mpnp.baechelin.store.domain; import com.mpnp.baechelin.util.TimeStamped; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; +import javax.persistence.*; @Entity @Getter @@ -18,6 +16,38 @@ public class UserRegisterStore extends TimeStamped { @GeneratedValue(strategy = GenerationType.AUTO) private int id; - + @Column(nullable = false, length = 1) + private String name; + @Column(nullable = false, length = 1) + private String address; + + @Column(nullable = false, length = 1) + private String elevator; + + @Column(nullable = false, length = 1) + private String toilet; + + @Column(nullable = false, length = 1) + private String heightDifferent; + + @Column(nullable = false, length = 1) + private String approach; + + @Builder + public UserRegisterStore( + String name, + String address, + String elevator, + String toilet, + String heightDifferent, + String approach + ) { + this.name = name; + this.address = address; + this.elevator = elevator; + this.toilet = toilet; + this.heightDifferent = heightDifferent; + this.approach = approach; + } } diff --git a/src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreRequestDto.java b/src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreRequestDto.java new file mode 100644 index 0000000..f3a00f9 --- /dev/null +++ b/src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreRequestDto.java @@ -0,0 +1,4 @@ +package com.mpnp.baechelin.store.dto.userRegisterStore; + +public class userRegisterStoreRequestDto { +} diff --git a/src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreResponseDto.java b/src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreResponseDto.java new file mode 100644 index 0000000..087e84e --- /dev/null +++ b/src/main/java/com/mpnp/baechelin/store/dto/userRegisterStore/userRegisterStoreResponseDto.java @@ -0,0 +1,15 @@ +package com.mpnp.baechelin.store.dto.userRegisterStore; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class userRegisterStoreResponseDto { + private String name; + private String address; + private String elevator; + private String toilet; + private String heightDifferent; + private String approach; +} diff --git a/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java b/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java index 250ca93..517bfdb 100644 --- a/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java +++ b/src/main/java/com/mpnp/baechelin/store/repository/StoreRepository.java @@ -4,6 +4,8 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface StoreRepository extends JpaRepository { } \ No newline at end of file diff --git a/src/main/java/com/mpnp/baechelin/user/entity/user/User.java b/src/main/java/com/mpnp/baechelin/user/entity/user/User.java index cd47a62..d12372f 100644 --- a/src/main/java/com/mpnp/baechelin/user/entity/user/User.java +++ b/src/main/java/com/mpnp/baechelin/user/entity/user/User.java @@ -1,6 +1,7 @@ package com.mpnp.baechelin.user.entity.user; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.mpnp.baechelin.bookmark.domain.Folder; import com.mpnp.baechelin.oauth.entity.ProviderType; import com.mpnp.baechelin.oauth.entity.RoleType; import com.mpnp.baechelin.review.domain.Review; @@ -53,6 +54,13 @@ public class User extends TimeStamped { @Enumerated(EnumType.STRING) private RoleType roleType; + // 연관관계 매핑 + @OneToMany(mappedBy = "userId", cascade = CascadeType.ALL, orphanRemoval = true) + private List folderList; + + @OneToMany(mappedBy = "userId", cascade = CascadeType.ALL, orphanRemoval = true) + private List reviewsList; + @Builder public User(String socialId, String name,