diff --git a/src/main/java/com/kusitms/samsion/domain/user/domain/entity/MyPet.java b/src/main/java/com/kusitms/samsion/domain/user/domain/entity/MyPet.java index 2194cd3..f51df84 100644 --- a/src/main/java/com/kusitms/samsion/domain/user/domain/entity/MyPet.java +++ b/src/main/java/com/kusitms/samsion/domain/user/domain/entity/MyPet.java @@ -1,14 +1,13 @@ package com.kusitms.samsion.domain.user.domain.entity; -import java.util.Objects; - -import javax.persistence.Embeddable; - import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import javax.persistence.Embeddable; +import java.util.Objects; + @Embeddable @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -49,7 +48,7 @@ public void updateInfo(MyPet myPet) { } private void updatePetName(String petName) { - if (!Objects.equals(petName, this.petName)) + if (!Objects.equals(petName, this.petName)&&Objects.nonNull(petName)) this.petName = petName; } @@ -59,7 +58,7 @@ private void updatePetImageUrl(String petImageUrl) { } private void updateDescription(String description) { - if (!Objects.equals(description, this.description)) + if (!Objects.equals(description, this.description)&&Objects.nonNull(description)) this.description = description; } @@ -69,7 +68,7 @@ private void updatePetAge(int petAge) { } private void updatePetType(String petType) { - if (!Objects.equals(petType, this.petType)) + if (!Objects.equals(petType, this.petType)&&Objects.nonNull(petType)) this.petType = petType; } diff --git a/src/main/java/com/kusitms/samsion/domain/user/domain/entity/User.java b/src/main/java/com/kusitms/samsion/domain/user/domain/entity/User.java index 7c4af34..355d6a9 100644 --- a/src/main/java/com/kusitms/samsion/domain/user/domain/entity/User.java +++ b/src/main/java/com/kusitms/samsion/domain/user/domain/entity/User.java @@ -1,21 +1,14 @@ package com.kusitms.samsion.domain.user.domain.entity; -import java.util.Objects; - -import javax.persistence.Column; -import javax.persistence.Embedded; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - import com.kusitms.samsion.common.domain.BaseEntity; - import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import javax.persistence.*; +import java.util.Objects; + @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -51,7 +44,7 @@ public void updateUserInfo(String userNickname,String profileImageUrl){ } public void updateNickname(String nickname){ - if(!Objects.equals(nickname, this.nickname)) + if(!Objects.equals(nickname, this.nickname)&&Objects.nonNull(nickname)) this.nickname = nickname; }