diff --git a/src/main/java/com/codesdream/ase/model/activity/Activity.java b/src/main/java/com/codesdream/ase/model/activity/Activity.java new file mode 100644 index 0000000..e63bf92 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/Activity.java @@ -0,0 +1,44 @@ +package com.codesdream.ase.model.activity; + +import com.codesdream.ase.model.file.File; +import com.codesdream.ase.model.mark.Tag; +import com.codesdream.ase.model.permission.User; +import lombok.Data; + +import javax.persistence.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Entity +@Table +@Data +public class Activity { + @Id + int id; + + String title; + + @ManyToOne + User Creator; + + @ManyToOne + User Manager; + + @ElementCollection + List participantIds = new ArrayList<>(); + + @OneToMany(cascade = CascadeType.MERGE) + List appendixes = new ArrayList<>(); + + Date registrationDDL; + + Date creationTime = new Date(); + + Date realBeginDate; + + Date realEndDate; + + @ManyToMany(cascade = CascadeType.MERGE) + List tags = new ArrayList<>(); +} diff --git a/src/main/java/com/codesdream/ase/model/activity/Report.java b/src/main/java/com/codesdream/ase/model/activity/Report.java new file mode 100644 index 0000000..976011f --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/Report.java @@ -0,0 +1,34 @@ +package com.codesdream.ase.model.activity; + +import com.codesdream.ase.model.file.Image; +import com.codesdream.ase.model.permission.User; +import lombok.Data; + +import javax.persistence.*; +import java.util.Date; +import java.util.List; + +@Entity +@Table +@Data +public class Report { + @Id + int id; + + String title; + + @ManyToOne(cascade = CascadeType.MERGE) + User creator; + + @ManyToOne(cascade = CascadeType.MERGE) + User manager; + + Date realBeginDate; + + Date realEndDate; + + String context; + + @ManyToMany + List images; +} diff --git a/src/main/java/com/codesdream/ase/model/file/File.java b/src/main/java/com/codesdream/ase/model/file/File.java new file mode 100644 index 0000000..a821721 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/file/File.java @@ -0,0 +1,22 @@ +package com.codesdream.ase.model.file; + +import lombok.Data; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +@Entity +@Table +@Data +public class File { + @Id + int id; + + String title; + + String url; + + Date creationTime; +} diff --git a/src/main/java/com/codesdream/ase/model/file/Image.java b/src/main/java/com/codesdream/ase/model/file/Image.java index 2b5e6f5..b47c078 100644 --- a/src/main/java/com/codesdream/ase/model/file/Image.java +++ b/src/main/java/com/codesdream/ase/model/file/Image.java @@ -9,6 +9,7 @@ public class Image { @GeneratedValue(strategy = GenerationType.AUTO) int id; + @Lob byte[] data; String description; diff --git a/src/main/java/com/codesdream/ase/model/mark/Tag.java b/src/main/java/com/codesdream/ase/model/mark/Tag.java index 7185205..94fc4f9 100644 --- a/src/main/java/com/codesdream/ase/model/mark/Tag.java +++ b/src/main/java/com/codesdream/ase/model/mark/Tag.java @@ -1,11 +1,14 @@ package com.codesdream.ase.model.mark; +import lombok.Data; + import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table +@Data public class Tag { @Id int id; diff --git a/src/main/java/com/codesdream/ase/model/student/Comment.java b/src/main/java/com/codesdream/ase/model/student/Comment.java index c91a476..44d446e 100644 --- a/src/main/java/com/codesdream/ase/model/student/Comment.java +++ b/src/main/java/com/codesdream/ase/model/student/Comment.java @@ -1,9 +1,12 @@ package com.codesdream.ase.model.student; +import lombok.Data; + import javax.persistence.*; @Entity @Table +@Data public class Comment { @Id @GeneratedValue(strategy = GenerationType.AUTO) diff --git a/src/main/java/com/codesdream/ase/model/student/Course.java b/src/main/java/com/codesdream/ase/model/student/Course.java new file mode 100644 index 0000000..f5fe30c --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/student/Course.java @@ -0,0 +1,18 @@ +package com.codesdream.ase.model.student; + +import lombok.Data; + +import javax.persistence.*; + +@Entity +@Table +@Data +public class Course { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + int id; + + String name; + + float credit; +} diff --git a/src/main/java/com/codesdream/ase/model/student/Honor.java b/src/main/java/com/codesdream/ase/model/student/Honor.java index cd328cd..0e03cd5 100644 --- a/src/main/java/com/codesdream/ase/model/student/Honor.java +++ b/src/main/java/com/codesdream/ase/model/student/Honor.java @@ -1,6 +1,7 @@ package com.codesdream.ase.model.student; import com.codesdream.ase.model.file.Image; +import lombok.Data; import javax.persistence.*; import java.util.Date; @@ -8,6 +9,7 @@ import java.util.List; @Entity @Table +@Data public class Honor { @Id @GeneratedValue(strategy = GenerationType.AUTO) diff --git a/src/main/java/com/codesdream/ase/model/student/Moment.java b/src/main/java/com/codesdream/ase/model/student/Moment.java index 7fcfe90..bc8de2f 100644 --- a/src/main/java/com/codesdream/ase/model/student/Moment.java +++ b/src/main/java/com/codesdream/ase/model/student/Moment.java @@ -1,6 +1,7 @@ package com.codesdream.ase.model.student; import com.codesdream.ase.model.file.Image; +import lombok.Data; import javax.persistence.*; import java.util.ArrayList; @@ -10,6 +11,7 @@ import java.util.concurrent.atomic.AtomicInteger; // 动态/说说 @Entity @Table +@Data public class Moment { @Id @GeneratedValue(strategy = GenerationType.AUTO) diff --git a/src/main/java/com/codesdream/ase/model/student/Notification.java b/src/main/java/com/codesdream/ase/model/student/Notification.java index 761d1af..d88cc79 100644 --- a/src/main/java/com/codesdream/ase/model/student/Notification.java +++ b/src/main/java/com/codesdream/ase/model/student/Notification.java @@ -1,11 +1,14 @@ package com.codesdream.ase.model.student; +import lombok.Data; + import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table +@Data public class Notification { @Id int id; diff --git a/src/main/java/com/codesdream/ase/model/student/Student.java b/src/main/java/com/codesdream/ase/model/student/Student.java index 84ceb34..770792a 100644 --- a/src/main/java/com/codesdream/ase/model/student/Student.java +++ b/src/main/java/com/codesdream/ase/model/student/Student.java @@ -2,6 +2,8 @@ package com.codesdream.ase.model.student; import com.codesdream.ase.model.mark.Tag; import com.codesdream.ase.model.permission.User; +import lombok.Data; +import lombok.EqualsAndHashCode; import javax.annotation.Generated; import javax.persistence.*; @@ -9,6 +11,8 @@ import java.util.List; @Entity @Table +@Data +@EqualsAndHashCode(callSuper = false) public class Student extends User { @Column(nullable = false) String studentId; @@ -18,5 +22,4 @@ public class Student extends User { String profilePicture; - } diff --git a/src/main/java/com/codesdream/ase/model/student/StudentCourse.java b/src/main/java/com/codesdream/ase/model/student/StudentCourse.java new file mode 100644 index 0000000..8b8d347 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/student/StudentCourse.java @@ -0,0 +1,28 @@ +package com.codesdream.ase.model.student; + +import lombok.Data; + +import javax.persistence.*; +import java.util.Date; + +@Entity +@Table +@Data +public class StudentCourse { + @Id + int id; + + @OneToOne(cascade = CascadeType.MERGE) + Student student; + + @OneToOne(cascade = CascadeType.MERGE) + Course course; + + @Column(nullable = false) + float score; + + boolean isFailed; + + Date finishedDate; + +}