student相关repository修改与完善
This commit is contained in:
parent
ccb1cb3682
commit
5d3b6ec02d
@ -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<Comment> comments = new ArrayList<>();
|
||||
|
||||
@OneToMany(cascade = CascadeType.MERGE)
|
||||
List<Image> images = new ArrayList<>();
|
||||
}
|
@ -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;
|
||||
|
@ -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<StudentCourse, Integer> {
|
||||
|
||||
List<StudentCourse> findByStudentId(String studentId);
|
||||
List<StudentCourse> findByStudentId(String studentId, Sort sort);
|
||||
}
|
Loading…
Reference in New Issue
Block a user