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..5dde2b8 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/Activity.java @@ -0,0 +1,174 @@ +package com.codesdream.ase.model.activity; + +import com.codesdream.ase.model.permission.User; +import lombok.Data; +import org.dom4j.QName; +import org.hibernate.annotations.CollectionId; +import org.hibernate.annotations.WhereJoinTable; +import org.springframework.context.annotation.EnableMBeanExport; + +import javax.persistence.*; +import java.util.Date; +import java.util.List; +import java.util.Set; + +@Data +@Entity +@Table(name = "activity", + indexes = { + @Index(name = "act_index1", columnList = "title", unique = true), + @Index(name = "act_index2", columnList = "creator") + } +) +public class Activity { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + //活动标题 + @Column(nullable = false, unique = true) + private String title; + + //创建人 + @Column(nullable = false) + private String creator; + + //活动类型1qa + @Column(nullable = false) + private String type; + + //活动描述 + @Column(nullable = true) + private String description; + + //自愿参与人列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_volunteer") + private Set volunteers; + + //参与人列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_participate", + joinColumns = { + @JoinColumn(name = "act_id") + }, + inverseJoinColumns = { + @JoinColumn(name = "participate_id") + } + ) + private Set participateGroup; + + //实际参与人列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_participated", + joinColumns = { + @JoinColumn(name = "act_id" ) + }, + inverseJoinColumns = { + @JoinColumn(name = "participated_id") + } + ) + private Set participatedGroup; + + //可报名人员列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_sign", + joinColumns = { + @JoinColumn(name = "act_id") + }, + inverseJoinColumns = { + @JoinColumn(name = "sign_id") + } + ) + private Set signGroup; + + //已报名人员列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_signed", + joinColumns = { + @JoinColumn(name = "act_id") + }, + inverseJoinColumns = { + @JoinColumn(name = "signed_id") + } + ) + private Set signedGroup; + + //可见人员人员列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_vis", + joinColumns = { + @JoinColumn(name = "act_id") + }, + inverseJoinColumns = { + @JoinColumn(name = "vis_id") + } + ) + private Set visibleGroup; + + //通知人员列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_inform", + joinColumns = { + @JoinColumn(name = "act_id") + }, + inverseJoinColumns = { + @JoinColumn(name = "inform_id") + } + ) + private Set informGroup; + + //已通知人员列表 + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "act_informed", + joinColumns = { + @JoinColumn(name = "act_id") + }, + inverseJoinColumns = { + @JoinColumn(name = "informed_id") + } + ) + private Set informedGroup; + + //计划开始时间 + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "plan_period") + private Period planPeriod; + + //实际开始时间 + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "real_period") + private Period realPeriod; + + //提前提醒时间 + @Column(name = "remind_time", nullable = true) + private Date remindTime; + + //附件组 + @ElementCollection(targetClass = java.lang.String.class) + private List enclosures; + + //主要负责人 + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "chief_manager", nullable = false) + private User chiefManager; + + //次要负责人 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "act_id") + private List assistManagers; + + //是否开始 + @JoinColumn(name = "is_on", nullable = false) + boolean isOn; + + //是否结束 + @JoinColumn(name = "is_off", nullable = false) + boolean isOff; + + //考勤安排 + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "attendance") + private Attendance attendance; + +} \ No newline at end of file diff --git a/src/main/java/com/codesdream/ase/model/activity/Attendance.java b/src/main/java/com/codesdream/ase/model/activity/Attendance.java new file mode 100644 index 0000000..45c9ce4 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/Attendance.java @@ -0,0 +1,34 @@ +package com.codesdream.ase.model.activity; + +import lombok.Data; + +import javax.persistence.*; +import java.util.List; +import java.util.Set; + +@Data +@Entity +@Table(name = "attendance") +public class Attendance { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + //二维码url + @Column(name = "qr_code", nullable = false, unique = true) + private String qrCode; + + //是否在线 + @Column(name = "is_online", nullable = false) + private boolean isOnline; + + //打卡时段列表 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "attendance") + @JoinColumn(name = "a_id") + private Set clockInPeriods; + + //打卡方式,0表示被扫,1表示扫 + @Column(nullable = false) + private boolean means; +} diff --git a/src/main/java/com/codesdream/ase/model/activity/Period.java b/src/main/java/com/codesdream/ase/model/activity/Period.java new file mode 100644 index 0000000..f85d56c --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/Period.java @@ -0,0 +1,30 @@ +package com.codesdream.ase.model.activity; + +import lombok.Data; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; + +import javax.persistence.*; +import java.util.Date; +import java.util.Objects; + +@Entity +@Table(name = "period_container") +@Data +public class Period { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + //开始时间 + @Column(name = "start_time", nullable = false) + private Date startTime; + + //结束时间 + @Column(name = "end_time", nullable = false) + private Date endTime; + + //启用状态 + @Column(name = "enabled", nullable = false) + private boolean enabled; + +} diff --git a/src/main/java/com/codesdream/ase/model/permission/Tag.java b/src/main/java/com/codesdream/ase/model/permission/Tag.java index 8fc4609..3160940 100644 --- a/src/main/java/com/codesdream/ase/model/permission/Tag.java +++ b/src/main/java/com/codesdream/ase/model/permission/Tag.java @@ -4,7 +4,6 @@ import lombok.Data; import org.hibernate.annotations.ManyToAny; import javax.persistence.*; -import java.util.HashMap; import java.util.HashSet; import java.util.Set;