Skip to content

Commit

Permalink
Merge pull request #2 from Likelion12/1-be-도메인-작성
Browse files Browse the repository at this point in the history
Feat : 도메인 작성
  • Loading branch information
SonMyeongJin authored Jul 30, 2024
2 parents 7143c4f + 32baa27 commit 7a5a601
Show file tree
Hide file tree
Showing 18 changed files with 510 additions and 7 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ out/

### VS Code ###
.vscode/
### macOS ###
.DS_Store
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
rootProject.name = 'demo'
include 'github'

Binary file added src/.DS_Store
Binary file not shown.
39 changes: 39 additions & 0 deletions src/main/java/com/example/likelion12/domain/ActivityRegion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.likelion12.domain;

import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class ActivityRegion extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "activity_region_id", nullable = false)
private long activityRegionId;

@Column(nullable = false)
private String activityRegionName;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

@JsonIgnore
@OneToMany(mappedBy = "activityRegion")
private List<Crew> crewList = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "activityRegion")
private List<Socialring> socialringList = new ArrayList<>();
}
76 changes: 76 additions & 0 deletions src/main/java/com/example/likelion12/domain/Crew.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.example.likelion12.domain;

import com.example.likelion12.domain.base.BaseGender;
import com.example.likelion12.domain.base.BaseLevel;
import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

import static jakarta.persistence.FetchType.LAZY;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class Crew extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "crew_id", nullable = false)
private long crewId;

@Column(nullable = false)
private String crewName;

private String crewImg;

@Column(nullable = false)
private int totalRecruits;

@Column(nullable = false)
private int crewCost;

@Column(nullable = false)
private String comment;

@Column(nullable = false)
private String commentSimple;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseGender gender;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseLevel level;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

@JsonIgnore
@OneToMany(mappedBy = "crew")
private List<MemberCrew> memberCrewList = new ArrayList<>();

/** 체육시설 과의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "facility_id")
private Facility facility;

/** 활동지역 과의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "activity_region_id")
private ActivityRegion activityRegion;

/** 운동종목 과의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "exercise_id")
private Exercise exercise;
}
39 changes: 39 additions & 0 deletions src/main/java/com/example/likelion12/domain/Exercise.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.likelion12.domain;

import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class Exercise extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "exercise_id", nullable = false)
private long exerciseId;

@Column(nullable = false)
private String exerciseName;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

@JsonIgnore
@OneToMany(mappedBy = "exercise")
private List<Crew> crewList = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "exercise")
private List<Socialring> socialringList = new ArrayList<>();
}
56 changes: 56 additions & 0 deletions src/main/java/com/example/likelion12/domain/Facility.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.example.likelion12.domain;

import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import static jakarta.persistence.FetchType.LAZY;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class Facility extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "facility_id", nullable = false)
private long facilityId;

@Column(nullable = false)
private String facilityName;

@Column(nullable = false)
private String facilityAddress;

private String facilityPhone;
private String facilitySize;
private String administer;
private LocalDateTime weekday;
private LocalDateTime weekend;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

@JsonIgnore
@OneToMany(mappedBy = "facility")
private List<Review> reviewList = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "facility")
private List<Socialring> socialringList = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "facility")
private List<Crew> crewList = new ArrayList<>();
}
51 changes: 44 additions & 7 deletions src/main/java/com/example/likelion12/domain/Member.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,60 @@
package com.example.likelion12.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import com.example.likelion12.domain.base.BaseGender;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class Member {
public class Member extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
@Column(name = "member_id", nullable = false)
private long memberId;

@Column(nullable = false)
private String memberName;

@Column(nullable = false)
private String id;

@Column(nullable = false)
private String password;

private String memberImg;

@Column(nullable = false)
private String memberPhone;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseGender gender;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

@JsonIgnore
@OneToMany(mappedBy = "member")
private List<Review> reviewList = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "member")
private List<MemberSocialring> memerSocialringList = new ArrayList<>();

@JsonIgnore
@OneToMany(mappedBy = "member")
private List<MemberCrew> memberCrewList = new ArrayList<>();

}
42 changes: 42 additions & 0 deletions src/main/java/com/example/likelion12/domain/MemberCrew.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.example.likelion12.domain;

import com.example.likelion12.domain.base.BaseRole;
import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.FetchType.LAZY;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class MemberCrew extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "member_crew_id", nullable = false)
private long memberCrewId;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseRole role;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

/** 크루 과의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "crew_id")
private Crew crew;

/** 멤버 와의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "member_id")
private Member member;

}
42 changes: 42 additions & 0 deletions src/main/java/com/example/likelion12/domain/MemberSocialring.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.example.likelion12.domain;

import com.example.likelion12.domain.base.BaseRole;
import com.example.likelion12.domain.base.BaseStatus;
import com.example.likelion12.domain.base.BaseTime;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static jakarta.persistence.FetchType.LAZY;

@Entity
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class MemberSocialring extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "member_socialring_id", nullable = false)
private long memberSocialringId;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseRole role;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private BaseStatus status;

/** 크루 과의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "socialring_id")
private Socialring socialring;

/** 멤버 와의 연관관계의 주인 */
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "member_id")
private Member member;

}
Loading

0 comments on commit 7a5a601

Please sign in to comment.