学生相关实体大致构建完成

This commit is contained in:
chuyan 2020-09-03 19:17:51 +08:00
parent 437cab45dc
commit e6d2941f3c
12 changed files with 164 additions and 1 deletions

View File

@ -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<Integer> participantIds = new ArrayList<>();
@OneToMany(cascade = CascadeType.MERGE)
List<File> appendixes = new ArrayList<>();
Date registrationDDL;
Date creationTime = new Date();
Date realBeginDate;
Date realEndDate;
@ManyToMany(cascade = CascadeType.MERGE)
List<Tag> tags = new ArrayList<>();
}

View File

@ -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<Image> images;
}

View File

@ -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;
}

View File

@ -9,6 +9,7 @@ public class Image {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
int id; int id;
@Lob
byte[] data; byte[] data;
String description; String description;

View File

@ -1,11 +1,14 @@
package com.codesdream.ase.model.mark; package com.codesdream.ase.model.mark;
import lombok.Data;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
@Entity @Entity
@Table @Table
@Data
public class Tag { public class Tag {
@Id @Id
int id; int id;

View File

@ -1,9 +1,12 @@
package com.codesdream.ase.model.student; package com.codesdream.ase.model.student;
import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
@Entity @Entity
@Table @Table
@Data
public class Comment { public class Comment {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)

View File

@ -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;
}

View File

@ -1,6 +1,7 @@
package com.codesdream.ase.model.student; package com.codesdream.ase.model.student;
import com.codesdream.ase.model.file.Image; import com.codesdream.ase.model.file.Image;
import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
@ -8,6 +9,7 @@ import java.util.List;
@Entity @Entity
@Table @Table
@Data
public class Honor { public class Honor {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)

View File

@ -1,6 +1,7 @@
package com.codesdream.ase.model.student; package com.codesdream.ase.model.student;
import com.codesdream.ase.model.file.Image; import com.codesdream.ase.model.file.Image;
import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -10,6 +11,7 @@ import java.util.concurrent.atomic.AtomicInteger;
// 动态/说说 // 动态/说说
@Entity @Entity
@Table @Table
@Data
public class Moment { public class Moment {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)

View File

@ -1,11 +1,14 @@
package com.codesdream.ase.model.student; package com.codesdream.ase.model.student;
import lombok.Data;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
@Entity @Entity
@Table @Table
@Data
public class Notification { public class Notification {
@Id @Id
int id; int id;

View File

@ -2,6 +2,8 @@ package com.codesdream.ase.model.student;
import com.codesdream.ase.model.mark.Tag; import com.codesdream.ase.model.mark.Tag;
import com.codesdream.ase.model.permission.User; import com.codesdream.ase.model.permission.User;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.annotation.Generated; import javax.annotation.Generated;
import javax.persistence.*; import javax.persistence.*;
@ -9,6 +11,8 @@ import java.util.List;
@Entity @Entity
@Table @Table
@Data
@EqualsAndHashCode(callSuper = false)
public class Student extends User { public class Student extends User {
@Column(nullable = false) @Column(nullable = false)
String studentId; String studentId;
@ -18,5 +22,4 @@ public class Student extends User {
String profilePicture; String profilePicture;
} }

View File

@ -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;
}