Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,31 @@ public List<Long> getTagIds() {
return tag;
}

public long getLimit() {
public Long getLimit() {
return pageCount;
}
public long getOffset() {
if(page == null)
page = 0;
return pageCount * page;
}

public void setTag(List<Long> tag) {
if(tag ==null || tag.isEmpty())
return;
this.tag = tag;
}

public void setPage(Integer page) {
if(page == null)
return;
this.page = page;
}

public void setPageCount(Long pageCount) {
if(pageCount == null)
return;
this.pageCount = pageCount;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public ResponseProjectListDto selectProjectDsl(RequestMainPageProjectListDto dto
}
);

orderByType(builder, ProjectOrderType.getType(dto.getOrder()), dto.getDesc());
if(dto.getOrder() != null && !dto.getOrder().isEmpty() && dto.getDesc() != null)
orderByType(builder, ProjectOrderType.getType(dto.getOrder()), dto.getDesc());

ResponseProjectListDto projectList = builder
.limit(dto.getLimit(), dto.getPage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum ProjectOrderType {
// }

public static <T> ProjectOrderType getType(String typeName) {
ProjectOrderType type = Arrays.stream(ProjectOrderType.values()).filter(t -> t.name().equals(typeName)).findFirst().orElse(ProjectOrderType.RECOMMEND);
ProjectOrderType type = Arrays.stream(ProjectOrderType.values()).filter(t -> t.name().equals(typeName)).findFirst().orElse(ProjectOrderType.CREATED);
return type;
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/NextLevel/demo/summery/dto/TotalSummeryDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public TotalSummeryDto(
Long totalSupporterCount,
Long totalCreatorCount
) {
this.totalFundingPrice = totalFundingPrice;
this.totalFundingCount = totalFundingCount;
this.totalSuccessProjectCount = totalSuccessProjectCount;
this.totalProgressProjectCount = totalProgressProjectCount;
this.totalSupporterCount = totalSupporterCount;
this.totalCreatorCount = totalCreatorCount;
this.totalFundingPrice = totalFundingPrice != null ? totalFundingPrice : 0L;
this.totalFundingCount = totalFundingCount != null ? totalFundingCount : 0L;
this.totalSuccessProjectCount = totalSuccessProjectCount != null ? totalSuccessProjectCount : 0L;
this.totalProgressProjectCount = totalProgressProjectCount != null ? totalProgressProjectCount : 0L;
this.totalSupporterCount = totalSupporterCount != null ? totalSupporterCount : 0L;
this.totalCreatorCount = totalCreatorCount != null ? totalCreatorCount : 0L;
}

}
14 changes: 7 additions & 7 deletions src/main/java/NextLevel/demo/summery/repo/SummeryRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@
public interface SummeryRepository extends Repository<UserEntity, Long> {

@Query("select sum(f.price) from FreeFundingEntity f")
long getTotalFreeFundingPrice();
Long getTotalFreeFundingPrice();

@Query("select count(f) from FreeFundingEntity f")
long getFreeFundingCount();
Long getFreeFundingCount();

@Query("select sum(of.count * of.option.price - coalesce(of.coupon.price, 0)) from OptionFundingEntity of")
long getTotalOptionFundingPrice();
Long getTotalOptionFundingPrice();

@Query("select count(of) from OptionFundingEntity of")
long getTotalOptionFundingCount();
Long getTotalOptionFundingCount();

@Query("select count(p) from ProjectEntity p where p.projectStatus in :status")
long getProjectCount(@Param("status") List<ProjectStatus> status);
Long getProjectCount(@Param("status") List<ProjectStatus> status);

@Query("select count(distinct u) from UserEntity u " +
"left join ProjectEntity p on p.user.id = u.id " +
"where p.id is not null")
long getCreatorCount();
Long getCreatorCount();

@Query("select count(distinct u) from UserEntity u " +
"left join FreeFundingEntity ff on ff.user.id = u.id " +
"left join OptionFundingEntity of on of.user.id = u.id " +
"where ff.id is not null or of.id is not null")
long getSupporterCount();
Long getSupporterCount();

}
Loading