活动子系统model初始构建完全

This commit is contained in:
chuyan 2020-02-15 15:18:07 +08:00 committed by yourtree
parent e34f87b01c
commit 3fa48eab50
3 changed files with 59 additions and 1 deletions

View File

@ -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<Activity> manageActivities;
//次要负责的活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> assistActivities;
//可见的活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> visibleActivities;
//创建的活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> createdActivities;
//可报名的活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> signUpActivities;
//已经参与的活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> participatedActivities;
//正在将要参与的活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> participatingActivities;
//打卡签到活动
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Activity> clockIn;
}

View File

@ -1,6 +1,7 @@
package com.codesdream.ase.model.permission; package com.codesdream.ase.model.permission;
import com.codesdream.ase.component.UserRolesListGenerator; import com.codesdream.ase.component.UserRolesListGenerator;
import com.codesdream.ase.model.activity.UserActivity;
import lombok.Data; import lombok.Data;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
@ -48,6 +49,8 @@ public class User implements UserDetails {
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private UserDetail userDetail; private UserDetail userDetail;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private UserActivity userActivity;
public User(String username, String password) { public User(String username, String password) {
this.username = username; this.username = username;

View File

@ -7,7 +7,7 @@ spring.thymeleaf.encoding=UTF-8
spring.jpa.generate-ddl=false spring.jpa.generate-ddl=false
spring.jpa.show-sql=true 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.jooq.sql-dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.open-in-view=true spring.jpa.open-in-view=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true