From 6943b7425bb432ef807c3db0c3fbe78d8580f5ee Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Fri, 14 Feb 2020 15:07:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E4=BA=8C=E6=AC=A1=E4=BF=AE?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 + .../ase/model/activity/Activity.java | 174 ++++++++++++++++++ .../ase/model/activity/Attendance.java | 34 ++++ .../{permission => activity}/Period.java | 10 +- .../ase/model/permission/Activity.java | 74 -------- .../codesdream/ase/model/permission/Tag.java | 1 - 6 files changed, 216 insertions(+), 83 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/model/activity/Activity.java create mode 100644 src/main/java/com/codesdream/ase/model/activity/Attendance.java rename src/main/java/com/codesdream/ase/model/{permission => activity}/Period.java (71%) delete mode 100644 src/main/java/com/codesdream/ase/model/permission/Activity.java diff --git a/pom.xml b/pom.xml index e1cc379..024f723 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,12 @@ runtime + + org.projectlombok + lombok + 1.16.10 + + 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/permission/Period.java b/src/main/java/com/codesdream/ase/model/activity/Period.java similarity index 71% rename from src/main/java/com/codesdream/ase/model/permission/Period.java rename to src/main/java/com/codesdream/ase/model/activity/Period.java index 062c2fe..f85d56c 100644 --- a/src/main/java/com/codesdream/ase/model/permission/Period.java +++ b/src/main/java/com/codesdream/ase/model/activity/Period.java @@ -1,4 +1,4 @@ -package com.codesdream.ase.model.permission; +package com.codesdream.ase.model.activity; import lombok.Data; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -23,14 +23,8 @@ public class Period { @Column(name = "end_time", nullable = false) private Date endTime; - //启用状体 + //启用状态 @Column(name = "enabled", nullable = false) private boolean enabled; - public Period(Date startTime, Date endTime, boolean enabled) { - this.startTime = startTime; - this.endTime = endTime; - this.enabled = enabled; - } - } diff --git a/src/main/java/com/codesdream/ase/model/permission/Activity.java b/src/main/java/com/codesdream/ase/model/permission/Activity.java deleted file mode 100644 index 2d98a37..0000000 --- a/src/main/java/com/codesdream/ase/model/permission/Activity.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.codesdream.ase.model.permission; - -import jdk.jfr.DataAmount; -import lombok.Data; -import org.hibernate.annotations.Cascade; -import sun.security.x509.DNSName; - -import javax.persistence.*; -import java.util.Set; - -@Entity -@Table(name = "activity_container") -@Data -public class Activity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private int id; - - //活动标题 - @Column(nullable = false) - 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") - }) - private Set participateGroup; - - private Set participatedGroup; - private Set signGroup; - private Set signedGroup; - private Set visibleGroup; - private Set informGroup; - private Set informedGroup; - private Period planPeriod; - private Period realPe - /* -participated_group list -sign_group list -signed_group list -visible_group list -inform_group list -informed_group list -plan_t_id long -real_t_id long -remind_time string -enclosure_id list -chief_manager long -assist_manager list -is_on bool -is_finished bool -c_id long - - */ - -} \ No newline at end of file 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 67bbc7a..a7da2a6 100644 --- a/src/main/java/com/codesdream/ase/model/permission/Tag.java +++ b/src/main/java/com/codesdream/ase/model/permission/Tag.java @@ -1,7 +1,6 @@ package com.codesdream.ase.model.permission; import javax.persistence.*; -import java.util.HashMap; import java.util.HashSet; import java.util.Set;