-
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.
Merge pull request #79 from uswLectureEvaluation/hotfix/lecture_schedule
hotfix: 시간표상 강의 조회 오류 해결 및 강의 테이블 구조 변경
- Loading branch information
Showing
13 changed files
with
325 additions
and
145 deletions.
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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/usw/suwiki/domain/lecture/domain/LectureSchedule.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,52 @@ | ||
package usw.suwiki.domain.lecture.domain; | ||
|
||
import java.util.Objects; | ||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.ManyToOne; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class LectureSchedule { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "place_schedule", nullable = false) | ||
private String placeSchedule; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Lecture lecture; | ||
|
||
@Builder | ||
public LectureSchedule(String placeSchedule, Lecture lecture) { | ||
this.placeSchedule = placeSchedule; | ||
associateLecture(lecture); | ||
} | ||
|
||
//------------------------------------------------------------------------- | ||
// 연관관계 메서드 | ||
//------------------------------------------------------------------------- | ||
private void associateLecture(Lecture lecture) { | ||
if (Objects.nonNull(this.lecture)) { | ||
this.lecture.removeSchedule(this); | ||
} | ||
this.lecture = lecture; | ||
lecture.addSchedule(this); | ||
} | ||
|
||
//------------------------------------------------------------------------- | ||
// 비즈니스 메서드 | ||
//------------------------------------------------------------------------- | ||
|
||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/usw/suwiki/domain/lecture/domain/repository/LectureScheduleRepository.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,7 @@ | ||
package usw.suwiki.domain.lecture.domain.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import usw.suwiki.domain.lecture.domain.LectureSchedule; | ||
|
||
public interface LectureScheduleRepository extends JpaRepository<LectureSchedule, Long> { | ||
} |
Oops, something went wrong.