-
Notifications
You must be signed in to change notification settings - Fork 0
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 #14 from khu-bigdata-project-team-5/feat/10
- Loading branch information
Showing
18 changed files
with
717 additions
and
89 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
src/main/java/khu/bigdata/infou/business/LectureConverter.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,70 @@ | ||
package khu.bigdata.infou.business; | ||
|
||
import khu.bigdata.infou.domain.LectureTag; | ||
import khu.bigdata.infou.domain.LectureUdemy; | ||
import khu.bigdata.infou.web.dto.LectureResponseDTO; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class LectureConverter { | ||
|
||
|
||
public static LectureResponseDTO.CategoryRecommendLectureInfo toCategoryRecommendLectureInfo(LectureUdemy lectureUdemy) { | ||
|
||
LectureTag lectureTag = lectureUdemy.getLectureTag(); | ||
|
||
return LectureResponseDTO.CategoryRecommendLectureInfo.builder() | ||
.lectureId(lectureUdemy.getLectureId()) | ||
.title(lectureUdemy.getTitle()) | ||
.price(lectureUdemy.getPrice()) | ||
.avgRating(lectureUdemy.getAvgRating()) | ||
.thumbnail(lectureUdemy.getThumbnail()) | ||
.topword1(lectureTag.getTopword1()) | ||
.topword2(lectureTag.getTopword2()) | ||
.topword3(lectureTag.getTopword3()) | ||
.topword4(lectureTag.getTopword4()) | ||
.topword5(lectureTag.getTopword5()) | ||
.build(); | ||
} | ||
|
||
public static LectureResponseDTO.CategoryRecommendLectureDto toCategoryRecommendLectureDto(List<LectureUdemy> list) { | ||
|
||
List<LectureResponseDTO.CategoryRecommendLectureInfo> infoList = list.stream().map(lecture -> toCategoryRecommendLectureInfo(lecture)).toList(); | ||
|
||
return LectureResponseDTO.CategoryRecommendLectureDto.builder() | ||
.lectureList(infoList) | ||
.build(); | ||
} | ||
|
||
|
||
// 키워드별 추천 강좌 조회 | ||
public static LectureResponseDTO.KeywordRecommendLectureInfo toKeywordRecommendLectureInfo(LectureUdemy lectureUdemy) { | ||
LectureTag lectureTag = lectureUdemy.getLectureTag(); | ||
|
||
return LectureResponseDTO.KeywordRecommendLectureInfo.builder() | ||
.lectureId(lectureUdemy.getLectureId()) | ||
.title(lectureUdemy.getTitle()) | ||
.price(lectureUdemy.getPrice()) | ||
.avgRating(lectureUdemy.getAvgRating()) | ||
.thumbnail(lectureUdemy.getThumbnail()) | ||
.topword1(lectureTag.getTopword1()) | ||
.topword2(lectureTag.getTopword2()) | ||
.topword3(lectureTag.getTopword3()) | ||
.topword4(lectureTag.getTopword4()) | ||
.topword5(lectureTag.getTopword5()) | ||
.build(); | ||
} | ||
|
||
public static LectureResponseDTO.KeywordRecommendLectureDto toKeywordRecommendLectureDto(List<LectureUdemy> lectureUdemyList) { | ||
|
||
List<LectureResponseDTO.KeywordRecommendLectureInfo> lectureInfos = lectureUdemyList.stream() | ||
.map(LectureConverter::toKeywordRecommendLectureInfo) | ||
.collect(Collectors.toList()); | ||
|
||
return LectureResponseDTO.KeywordRecommendLectureDto.builder() | ||
.lectureList(lectureInfos) | ||
.build(); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
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,54 @@ | ||
package khu.bigdata.infou.domain; | ||
|
||
import jakarta.persistence.*; | ||
import khu.bigdata.infou.domain.enums.LectureType; | ||
import lombok.*; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@DynamicInsert | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) // 생성 로직 규정 | ||
@Table(name = "lecture_detail") | ||
public class LectureDetail { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Integer id; | ||
|
||
@Column(name = "lecture_id", nullable = false) | ||
private Integer lectureId; | ||
|
||
@Column(name = "good", nullable = false) | ||
private Integer good; | ||
|
||
@Column(name = "bad", nullable = false) | ||
private Integer bad; | ||
|
||
@Column(name = "teaching_quality", nullable = false) | ||
private Float teachingQuality; | ||
|
||
@Column(name = "reference", nullable = false) | ||
private Float reference; | ||
|
||
@Column(name = "practice", nullable = false) | ||
private Float practice; | ||
|
||
@Column(name = "rating", nullable = false) | ||
private Float rating; | ||
|
||
@Column(name = "level", nullable = false) | ||
private Float level; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "lecture_type", nullable = false) | ||
private LectureType lectureType; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
private LectureInflearn lectureInflearn; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
private LectureUdemy lectureUdemy; | ||
} |
86 changes: 86 additions & 0 deletions
86
src/main/java/khu/bigdata/infou/domain/LectureInflearn.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,86 @@ | ||
package khu.bigdata.infou.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.DynamicInsert; | ||
|
||
import java.util.Date; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@DynamicInsert | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) // 생성 로직 규정 | ||
@Table(name = "lecture_inflearn") | ||
public class LectureInflearn { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "lecture_inflearn_id") | ||
private int lectureInflearnId; | ||
|
||
@Column(name = "slug", columnDefinition = "TEXT") | ||
private String slug; | ||
|
||
@Column(name = "thumbnailUrl", columnDefinition = "TEXT") | ||
private String thumbnailUrl; | ||
|
||
@Column(name = "title", columnDefinition = "TEXT") | ||
private String title; | ||
|
||
@Column(name = "description", columnDefinition = "TEXT") | ||
private String description; | ||
|
||
@Column(name = "reviewCount") | ||
private int reviewCount; | ||
|
||
@Column(name = "studentCount") | ||
private int studentCount; | ||
|
||
@Column(name = "likeCount") | ||
private int likeCount; | ||
|
||
@Column(name = "star") | ||
private float star; | ||
|
||
@Column(name = "isExclusive") | ||
private boolean isExclusive; | ||
|
||
@Column(name = "isNew") | ||
private boolean isNew; | ||
|
||
@Column(name = "isUpdated") | ||
private boolean isUpdated; | ||
|
||
@Column(name = "updatedAt") | ||
@Temporal(TemporalType.DATE) | ||
private Date updatedAt; | ||
|
||
@Column(name = "publishedAt") | ||
@Temporal(TemporalType.DATE) | ||
private Date publishedAt; | ||
|
||
@Column(name = "metadata", columnDefinition = "JSON") | ||
private String metadata; | ||
|
||
@Column(name = "instructor_id") | ||
private int instructorId; | ||
|
||
@Column(name = "instructor_name", length = 50) | ||
private String instructorName; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "platform_student_lecture_id") | ||
private PlatformStudentLecture platformStudentLecture; | ||
|
||
|
||
public void setPlatformStudentLecture(PlatformStudentLecture platformStudentLecture) { | ||
if (this.platformStudentLecture != null) { | ||
this.platformStudentLecture.getLectureInflearnList().remove(this); | ||
} | ||
this.platformStudentLecture = platformStudentLecture; | ||
} | ||
// getters and setters | ||
} | ||
|
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
Oops, something went wrong.