-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Calender #43
Open
AlreadyBold
wants to merge
2
commits into
KKSC-1:master
Choose a base branch
from
AlreadyBold:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Calender #43
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
24 changes: 24 additions & 0 deletions
24
src/main/java/KKSC/page/domain/calendar/dto/EventResponseInterface.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,24 @@ | ||
package KKSC.page.domain.calendar.dto; | ||
|
||
import java.time.LocalDateTime; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
||
import KKSC.page.domain.calendar.entity.Category; | ||
|
||
public interface EventResponseInterface { | ||
|
||
Long getId(); | ||
String getTitle(); | ||
String getDetail(); | ||
|
||
Category getCategory(); | ||
|
||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss", timezone = "Asia/Seoul") | ||
LocalDateTime getStartDate(); | ||
|
||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss", timezone = "Asia/Seoul") | ||
LocalDateTime getEndDate(); | ||
|
||
Long getMaxParticipant(); | ||
|
||
} |
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
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
20 changes: 20 additions & 0 deletions
20
src/main/java/KKSC/page/domain/calendar/repoAndService/EventRepository.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,7 +1,27 @@ | ||
package KKSC.page.domain.calendar.repoAndService; | ||
|
||
import KKSC.page.domain.calendar.dto.EventResponseInterface; | ||
import KKSC.page.domain.calendar.entity.Event; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
|
||
public interface EventRepository extends JpaRepository<Event, Long>, EventRepositoryCustom { | ||
@Query(value = "SELECT "+ | ||
"event_id as id,"+ | ||
"title as title,"+ | ||
"detail as detail,"+ | ||
"category as category,"+ | ||
"start_date as startDate,"+ | ||
"end_date as endDate ,"+ | ||
"max_participant as maxParticipant "+ | ||
"FROM event "+ | ||
"WHERE YEAR(end_date) = :Year "+ | ||
"AND MONTH(end_date) = :Month " | ||
, nativeQuery = true) | ||
List<EventResponseInterface> EventList(@Param("Year") int Year,@Param("Month") int Month); | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/KKSC/page/domain/calendar/repoAndService/ParticipantRepository.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,9 @@ | ||
package KKSC.page.domain.calendar.repoAndService; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import KKSC.page.domain.calendar.entity.Participant; | ||
|
||
public interface ParticipantRepository extends JpaRepository<Participant, Long> { | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response는 단순 dto 용도로만 사용되는 걸로 아는데 요러면 이점이 뭔가여 형님
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단 nativequery 를 DTO 맵핑 시켜주기 위해서 interface로 생성했고
프론트엔드에서 가공없이 보여줄수있게끔 jsonformat 설정해서 값을 반환하게끔 하였숨
이점은...
nativequery 에서 바로 DTO 맵핑가능해서 편하다 ( 일반 querydsl 이나 jpa 처럼 바로 맵핑해서 보내면 됨 )
이게 궁금한게 아닝가..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오.. 이런 방식은 첨 알았네요 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
방법은 직접 map을 생성해서 맵핑해줄수도 있고.. 뭐 그렇다고는 하던데
중요한것은 nativeQuery<<<<<<<<<<<Querydsl 이라는 것인데
관련사항은 검색해보면 나올고야