diff --git a/src/main/java/com/sm/project/converter/community/PostConverter.java b/src/main/java/com/sm/project/converter/community/PostConverter.java index 290113e..22382fb 100644 --- a/src/main/java/com/sm/project/converter/community/PostConverter.java +++ b/src/main/java/com/sm/project/converter/community/PostConverter.java @@ -73,7 +73,7 @@ public static PostResponseDTO.PostListDTO toPostList(List postList, Member .title(post.getTitle()) .status(post.getStatus()) .content(post.getContent()) - .nickname(member.getNickname()) + .nickname(post.getMember().getNickname()) .createdAt(post.getCreatedAt()) .itemImgUrlList(imgs) .build(); diff --git a/src/main/java/com/sm/project/repository/community/PostRepository.java b/src/main/java/com/sm/project/repository/community/PostRepository.java index 0eb239b..953b5ca 100644 --- a/src/main/java/com/sm/project/repository/community/PostRepository.java +++ b/src/main/java/com/sm/project/repository/community/PostRepository.java @@ -5,6 +5,7 @@ import com.sm.project.domain.member.Location; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import java.util.List; @@ -22,5 +23,5 @@ public interface PostRepository extends JpaRepository { * @return 게시글 목록 */ @Query("SELECT p FROM Post p WHERE (:postTopicType IS NULL OR p.topic = :postTopicType) AND p.id > :lastIndex AND (:location IS NULL OR p.location = :location) ORDER BY p.id ASC") - List findPostList(Long lastIndex, PostTopicType postTopicType, Location location); + List findPostList(@Param("lastIndex") Long lastIndex, @Param("postTopicType") PostTopicType postTopicType, @Param("location") Location location); }