-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
171 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/likelion/MZConnent/dto/club/request/ClubSimpleRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package likelion.MZConnent.dto.club.request; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class ClubSimpleRequest { | ||
private Long cultureId; | ||
private Long regionId; | ||
|
||
@Builder | ||
public ClubSimpleRequest(Long cultureId, Long regionId) { | ||
this.cultureId = cultureId; | ||
this.regionId = regionId; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/likelion/MZConnent/dto/club/response/ClubSimpleResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package likelion.MZConnent.dto.club.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class ClubSimpleResponse { | ||
private Long clubId; | ||
private String title; | ||
private Long regionId; | ||
private String regionName; | ||
private Long cultureCategoryId; | ||
private String cultureName; | ||
private String leaderProfileImage; | ||
private LocalDate meetingDate; | ||
private LocalDateTime createdDate; | ||
private String genderRestriction; | ||
private String ageRestriction; | ||
private int currentParticipant; | ||
private int maxParticipant; | ||
|
||
@Builder | ||
public ClubSimpleResponse(Long clubId, String title, Long regionId, String regionName, Long cultureCategoryId, | ||
String cultureName, String leaderProfileImage, LocalDate meetingDate, | ||
LocalDateTime createdDate, String genderRestriction, String ageRestriction, | ||
int currentParticipant, int maxParticipant) { | ||
this.clubId = clubId; | ||
this.title = title; | ||
this.regionId = regionId; | ||
this.regionName = regionName; | ||
this.cultureCategoryId = cultureCategoryId; | ||
this.cultureName = cultureName; | ||
this.leaderProfileImage = leaderProfileImage; | ||
this.meetingDate = meetingDate; | ||
this.createdDate = createdDate; | ||
this.genderRestriction = genderRestriction; | ||
this.ageRestriction = ageRestriction; | ||
this.currentParticipant = currentParticipant; | ||
this.maxParticipant = maxParticipant; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/likelion/MZConnent/dto/club/response/PageContentResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package likelion.MZConnent.dto.club.response; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class PageContentResponse<T> { | ||
private List<T> content; | ||
private int totalPages; | ||
private long totalElements; | ||
private int size; | ||
|
||
public PageContentResponse(List<T> content, int totalPages, long totalElements, int size) { | ||
this.content = content; | ||
this.totalPages = totalPages; | ||
this.totalElements = totalElements; | ||
this.size = size; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/likelion/MZConnent/repository/club/ClubRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
package likelion.MZConnent.repository.club; | ||
|
||
import likelion.MZConnent.domain.club.Club; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ClubRepository extends JpaRepository<Club, Long> { | ||
|
||
// status가 OPEN인 클럽만 조회 | ||
// cultureId와 regionId가 0이면 무시 | ||
// cultureId와 regionId가 0이 아니면 해당 cultureId와 regionId에 맞는 클럽만 조회 | ||
@Query("SELECT c FROM Club c WHERE c.status = 'OPEN' " + | ||
"AND (:cultureId = 0 OR c.culture.cultureId = :cultureId) " + | ||
"AND (:regionId = 0 OR c.region.regionId = :regionId)") | ||
Page<Club> findAllByFilters(@Param("cultureId") Long cultureId, | ||
@Param("regionId") Long regionId, | ||
Pageable pageable); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters