From 3fa48eab50bb0da26d3903b8ba4eb862073a199f Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Sat, 15 Feb 2020 15:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=AD=90=E7=B3=BB=E7=BB=9Fmo?= =?UTF-8?q?del=E5=88=9D=E5=A7=8B=E6=9E=84=E5=BB=BA=E5=AE=8C=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ase/model/activity/UserActivity.java | 55 +++++++++++++++++++ .../codesdream/ase/model/permission/User.java | 3 + src/main/resources/application.properties | 2 +- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/codesdream/ase/model/activity/UserActivity.java diff --git a/src/main/java/com/codesdream/ase/model/activity/UserActivity.java b/src/main/java/com/codesdream/ase/model/activity/UserActivity.java new file mode 100644 index 0000000..8c610c8 --- /dev/null +++ b/src/main/java/com/codesdream/ase/model/activity/UserActivity.java @@ -0,0 +1,55 @@ +package com.codesdream.ase.model.activity; + +import com.codesdream.ase.model.permission.User; +import javafx.scene.chart.ScatterChart; +import lombok.Data; + +import javax.persistence.*; +import java.util.List; + +@Data +@Entity +@Table(name = "user_act") +public class UserActivity { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + //关联的用户 + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "userActivity") + @JoinColumn(nullable = false) + private User user; + + //主要负责的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List manageActivities; + + //次要负责的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List assistActivities; + + //可见的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List visibleActivities; + + //创建的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List createdActivities; + + //可报名的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List signUpActivities; + + //已经参与的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List participatedActivities; + + //正在(将要)参与的活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List participatingActivities; + + //打卡签到活动 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List clockIn; +} diff --git a/src/main/java/com/codesdream/ase/model/permission/User.java b/src/main/java/com/codesdream/ase/model/permission/User.java index 45c446a..c649974 100644 --- a/src/main/java/com/codesdream/ase/model/permission/User.java +++ b/src/main/java/com/codesdream/ase/model/permission/User.java @@ -1,6 +1,7 @@ package com.codesdream.ase.model.permission; import com.codesdream.ase.component.UserRolesListGenerator; +import com.codesdream.ase.model.activity.UserActivity; import lombok.Data; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @@ -48,6 +49,8 @@ public class User implements UserDetails { @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private UserDetail userDetail; + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private UserActivity userActivity; public User(String username, String password) { this.username = username; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f04afda..e33dd03 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,7 +7,7 @@ spring.thymeleaf.encoding=UTF-8 spring.jpa.generate-ddl=false spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=create +spring.jpa.hibernate.ddl-auto=update spring.jooq.sql-dialect=org.hibernate.dialect.MySQL5InnoDBDialect spring.jpa.open-in-view=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true