From 60356b46fa1cdfe4b5a0b23139923cde2a68bc92 Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Fri, 14 Feb 2020 16:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=AD=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=89=E6=AC=A1=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../ase/component/UsersListGenerator.java | 2 - .../ase/model/activity/Activity.java | 16 +- .../ase/model/activity/Attendance.java | 3 +- .../codesdream/ase/model/activity/Report.java | 178 ++++++++++++++++++ .../FunctionalPermissionContainer.java | 3 +- .../codesdream/ase/model/permission/Tag.java | 2 +- .../ase/repository/UserRepository.java | 2 +- 8 files changed, 193 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/model/activity/Report.java diff --git a/pom.xml b/pom.xml index 024f723..057256f 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.projectlombok lombok 1.16.10 - + s diff --git a/src/main/java/com/codesdream/ase/component/UsersListGenerator.java b/src/main/java/com/codesdream/ase/component/UsersListGenerator.java index 60193ce..6bbff53 100644 --- a/src/main/java/com/codesdream/ase/component/UsersListGenerator.java +++ b/src/main/java/com/codesdream/ase/component/UsersListGenerator.java @@ -3,9 +3,7 @@ package com.codesdream.ase.component; import com.codesdream.ase.model.permission.Tag; import com.codesdream.ase.model.permission.User; import org.springframework.stereotype.Component; -import sun.nio.cs.US_ASCII; -import javax.annotation.Resource; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/com/codesdream/ase/model/activity/Activity.java b/src/main/java/com/codesdream/ase/model/activity/Activity.java index 5dde2b8..a000984 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Activity.java +++ b/src/main/java/com/codesdream/ase/model/activity/Activity.java @@ -33,7 +33,7 @@ public class Activity { @Column(nullable = false) private String creator; - //活动类型1qa + //活动类型 @Column(nullable = false) private String type; @@ -41,6 +41,10 @@ public class Activity { @Column(nullable = true) private String description; + //活动周期,格式:阿拉伯数字数字+单位,0表示无周期 + @Column(nullable = true) + private String cycle; + //自愿参与人列表 @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "act_volunteer") @@ -94,7 +98,7 @@ public class Activity { ) private Set signedGroup; - //可见人员人员列表 + //可见人员列表 @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "act_vis", joinColumns = { @@ -132,12 +136,10 @@ public class Activity { //计划开始时间 @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "plan_period") private Period planPeriod; //实际开始时间 @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "real_period") private Period realPeriod; //提前提醒时间 @@ -150,7 +152,7 @@ public class Activity { //主要负责人 @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "chief_manager", nullable = false) + @JoinColumn(nullable = false) private User chiefManager; //次要负责人 @@ -168,7 +170,9 @@ public class Activity { //考勤安排 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @JoinColumn(name = "attendance") private Attendance attendance; + //活动报告 + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private Report report; } \ 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 index 45c9ce4..f65f92a 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Attendance.java +++ b/src/main/java/com/codesdream/ase/model/activity/Attendance.java @@ -24,8 +24,7 @@ public class Attendance { private boolean isOnline; //打卡时段列表 - @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "attendance") - @JoinColumn(name = "a_id") + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set clockInPeriods; //打卡方式,0表示被扫,1表示扫 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..dbeaf37 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/Report.java @@ -0,0 +1,178 @@ +package com.codesdream.ase.model.activity; + +import com.codesdream.ase.model.permission.User; +import lombok.Data; + +import javax.persistence.*; +import java.awt.*; +import java.util.Date; +import java.util.List; +import java.util.Set; + +@Data +@Entity +@Table(name = "report", + indexes = { + @Index(name = "report_index1", columnList = "title"), + @Index(name = "report_index2", columnList = "creator") + } +) +public class Report { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + //活动标题 + @Column(nullable = false, unique = true) + private String title; + + //创建人 + @Column(nullable = false) + private String creator; + + //活动类型 + @Column(nullable = false) + private String type; + + //活动描述 + @Column(nullable = true) + private String description; + + //活动周期,格式:阿拉伯数字数字+单位,0表示无周期 + @Column(nullable = true) + private String cycle; + + //自愿参与人列表 + @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; + + //主要负责人 + @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; + + + //考勤安排 + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "attendance") + private Attendance attendance; + + //活动笔记 + @Column(name = "notes") + private String notes; + + //图表 + @ElementCollection(targetClass = java.lang.String.class) + @Column(name = "charts") + private List charts; + + //附件url + @Column(name = "enclosure") + private String enclosure; + + //活动 + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "activity") + private Activity activity; +} diff --git a/src/main/java/com/codesdream/ase/model/permission/FunctionalPermissionContainer.java b/src/main/java/com/codesdream/ase/model/permission/FunctionalPermissionContainer.java index 4784d1e..19c2577 100644 --- a/src/main/java/com/codesdream/ase/model/permission/FunctionalPermissionContainer.java +++ b/src/main/java/com/codesdream/ase/model/permission/FunctionalPermissionContainer.java @@ -3,10 +3,9 @@ package com.codesdream.ase.model.permission; import lombok.Data; import javax.persistence.*; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Set; + /** * 功能性权限容器 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 3160940..0e79659 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,7 @@ package com.codesdream.ase.model.permission; import lombok.Data; -import org.hibernate.annotations.ManyToAny; + import javax.persistence.*; import java.util.HashSet; diff --git a/src/main/java/com/codesdream/ase/repository/UserRepository.java b/src/main/java/com/codesdream/ase/repository/UserRepository.java index 3056837..486beec 100644 --- a/src/main/java/com/codesdream/ase/repository/UserRepository.java +++ b/src/main/java/com/codesdream/ase/repository/UserRepository.java @@ -6,7 +6,7 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import java.util.Optional; -import java.util.Set; + @Repository public interface UserRepository extends CrudRepository {