diff --git a/src/main/java/com/codesdream/ase/model/student/Moment.java b/src/main/java/com/codesdream/ase/model/student/Moment.java deleted file mode 100644 index bc8de2f..0000000 --- a/src/main/java/com/codesdream/ase/model/student/Moment.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.codesdream.ase.model.student; - -import com.codesdream.ase.model.file.Image; -import lombok.Data; - -import javax.persistence.*; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -// 动态/说说 -@Entity -@Table -@Data -public class Moment { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - int id; - - int userId; - // 动态内容 - String description; - - // 点赞计数 - AtomicInteger likeCount = new AtomicInteger(0); - - // 评论 - @OneToMany(cascade = CascadeType.ALL) - List comments = new ArrayList<>(); - - @OneToMany(cascade = CascadeType.MERGE) - List images = new ArrayList<>(); -} \ No newline at end of file diff --git a/src/main/java/com/codesdream/ase/model/student/StudentCourse.java b/src/main/java/com/codesdream/ase/model/student/StudentCourse.java index 8b8d347..0c1c52e 100644 --- a/src/main/java/com/codesdream/ase/model/student/StudentCourse.java +++ b/src/main/java/com/codesdream/ase/model/student/StudentCourse.java @@ -12,15 +12,14 @@ public class StudentCourse { @Id int id; - @OneToOne(cascade = CascadeType.MERGE) - Student student; + String studentId; - @OneToOne(cascade = CascadeType.MERGE) - Course course; + String courseId; @Column(nullable = false) float score; + @Column(nullable = false) boolean isFailed; Date finishedDate; diff --git a/src/main/java/com/codesdream/ase/repository/student/SCRepository.java b/src/main/java/com/codesdream/ase/repository/student/SCRepository.java new file mode 100644 index 0000000..4b170a4 --- /dev/null +++ b/src/main/java/com/codesdream/ase/repository/student/SCRepository.java @@ -0,0 +1,15 @@ +package com.codesdream.ase.repository.student; + +import com.codesdream.ase.model.student.StudentCourse; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SCRepository extends JpaRepository { + + List findByStudentId(String studentId); + List findByStudentId(String studentId, Sort sort); +}