Skip to content

Commit

Permalink
Merge pull request #56 from 80000Coding/modify_queryDsl
Browse files Browse the repository at this point in the history
컬럼명 변경으로 인한 querydsl 변경
  • Loading branch information
dnjsals45 authored Jan 8, 2024
2 parents 18367d8 + a6a9e1e commit 76db0a0
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.querydsl.jpa.impl.JPAQuery;
import com.querydsl.jpa.impl.JPAQueryFactory;
import io.oopy.coding.domain.content.entity.Content;
import io.oopy.coding.domain.content.entity.ContentType;
import io.oopy.coding.domain.user.entity.User;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
Expand Down Expand Up @@ -34,11 +35,12 @@ public Page<User> findByNickname(String nickname, Pageable pageable) {
return PageableExecutionUtils.getPage(fetch, pageable, count::fetchOne);
}

//post project
public long countPostByUserId(long id) {
long postCount = queryFactory.selectFrom(content)
.where(content.user.id.eq(id)
.and(content.type.eq("post"))
.and(content.complete.eq(true))
.and(content.type.eq(ContentType.POST))
.and(content.publish.eq(true))
.and(content.deleteAt.isNull())
)
.fetchCount();
Expand All @@ -49,8 +51,8 @@ public long countPostByUserId(long id) {
public long countProjByUserId(long id) {
long postCount = queryFactory.selectFrom(content)
.where(content.user.id.eq(id)
.and(content.type.eq("proj"))
.and(content.complete.eq(true))
.and(content.type.eq(ContentType.PROJECT))
.and(content.publish.eq(true))
.and(content.deleteAt.isNull())
)
.fetchCount();
Expand Down

0 comments on commit 76db0a0

Please sign in to comment.