diff --git a/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java b/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java index 2bb244d..f80ce27 100644 --- a/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java +++ b/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java @@ -179,10 +179,15 @@ public Page findAllByBoardIdAndGroupCodeAndMemberCode(Long boardId, GroupC if (memberCode != null) { whereClause.and(memberEntity.memberCode.eq(memberCode)); } +// if (groupCode != null) { +// whereClause.and(groupEntity.groupCode.eq(groupCode)); +// } + if (groupCode != null) { - whereClause.and(groupEntity.groupCode.eq(groupCode)); + whereClause.and(groupEntity.isNotNull().and(groupEntity.groupCode.eq(groupCode))); } + // if (whereClause.getValue() == null) { // throw new IllegalArgumentException("At least one of memberCode, or groupCode must be provided"); // } @@ -196,6 +201,7 @@ public Page findAllByBoardIdAndGroupCodeAndMemberCode(Long boardId, GroupC .where(whereClause) .orderBy(postEntity.createdAt.desc()); + List content = query .offset(pageable.getOffset()) .limit(pageable.getPageSize())