From bf01bb66e581f0779db57e4c98d684d433061c21 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 10 Jul 2024 14:12:18 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20-=20?= =?UTF-8?q?=EA=B5=AC=EB=A7=A4=ED=95=9C=20=EC=9C=A0=EB=A3=8C=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EB=AC=BC=EC=9D=80=20=ED=81=AC=EB=A6=AC=EC=97=90?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=EA=B0=80=20=EC=82=AD=EC=A0=9C=ED=95=98?= =?UTF-8?q?=EB=8D=94=EB=9D=BC=EB=8F=84=20=EC=A1=B0=ED=9A=8C=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorCommunityRepository.kt | 19 ++++++++++++++++--- .../CreatorCommunityService.kt | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt index 16247ae..2ae3834 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.explorer.profile.creatorCommunity import com.querydsl.core.types.dsl.Expressions import com.querydsl.jpa.impl.JPAQueryFactory +import kr.co.vividnext.sodalive.can.use.QUseCan.useCan import kr.co.vividnext.sodalive.explorer.profile.creatorCommunity.QCreatorCommunity.creatorCommunity import kr.co.vividnext.sodalive.member.QMember.member import kr.co.vividnext.sodalive.member.following.QCreatorFollowing.creatorFollowing @@ -17,6 +18,7 @@ interface CreatorCommunityQueryRepository { fun getCommunityPostList( creatorId: Long, + memberId: Long, offset: Long, limit: Long, isAdult: Boolean @@ -41,12 +43,13 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact override fun getCommunityPostList( creatorId: Long, + memberId: Long, offset: Long, limit: Long, isAdult: Boolean ): List { - var where = creatorCommunity.member.id.eq(creatorId) - .and(creatorCommunity.isActive.isTrue) + var where = creatorCommunity.isActive.isTrue + .or(useCan.communityPost.isNotNull) if (!isAdult) { where = where.and(creatorCommunity.isAdult.isFalse) @@ -67,7 +70,17 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact ) ) .from(creatorCommunity) - .innerJoin(creatorCommunity.member, member) + .innerJoin(member) + .on( + creatorCommunity.member.id.eq(member.id) + .and(member.id.eq(creatorId)) + ) + .leftJoin(useCan) + .on( + creatorCommunity.id.eq(useCan.communityPost.id) + .and(useCan.member.id.eq(memberId)) + .and(useCan.isRefund.isFalse) + ) .where(where) .offset(offset) .limit(limit) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt index 44a3ed6..cf429c1 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt @@ -150,6 +150,7 @@ class CreatorCommunityService( val postList = repository.getCommunityPostList( creatorId = creatorId, + memberId = memberId, offset = offset, limit = limit, isAdult = isAdult -- 2.40.1 From 77a9f1a13c4e5eb706554cf25c900ea9d7527738 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 10 Jul 2024 14:21:28 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20-=20where?= =?UTF-8?q?=EC=A0=88=EC=9D=98=20=EC=88=9C=EC=84=9C=EB=A5=BC=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=98=EC=97=AC=20=ED=98=B9=EC=8B=9C=20=EC=83=9D?= =?UTF-8?q?=EA=B8=B8=20=EC=88=98=20=EC=9E=88=EB=8A=94=20=EB=B6=88=EC=83=81?= =?UTF-8?q?=EC=82=AC=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/creatorCommunity/CreatorCommunityRepository.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt index 2ae3834..49e22a7 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt @@ -49,12 +49,13 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact isAdult: Boolean ): List { var where = creatorCommunity.isActive.isTrue - .or(useCan.communityPost.isNotNull) if (!isAdult) { where = where.and(creatorCommunity.isAdult.isFalse) } + where = where.or(useCan.communityPost.isNotNull) + return queryFactory .select( QSelectCommunityPostResponse( -- 2.40.1