게임 패키지 모델 생

This commit is contained in:
byung eun park 2019-10-17 17:32:41 +09:00
parent 30a61204b9
commit 706df2a934
22 changed files with 490 additions and 150 deletions

View File

@ -3,7 +3,6 @@ package com.totopia.server.commons.data.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;

View File

@ -2,10 +2,8 @@ package com.totopia.server.init;
import com.totopia.server.modules.dashboard.repository.DashboardRepository; import com.totopia.server.modules.dashboard.repository.DashboardRepository;
import com.totopia.server.modules.game.entity.LeagueEntity; import com.totopia.server.modules.game.entity.LeagueEntity;
import com.totopia.server.modules.game.entity.SportsEntity;
import com.totopia.server.modules.game.repository.LeagueRepository; import com.totopia.server.modules.game.repository.LeagueRepository;
import com.totopia.server.modules.game.repository.SportsRepository; import com.totopia.server.modules.game.type.SportsTypeName;
import com.totopia.server.modules.game.type.SportsName;
import com.totopia.server.modules.site.entity.BankAccountsEntity; import com.totopia.server.modules.site.entity.BankAccountsEntity;
import com.totopia.server.modules.site.repository.BankAccountsRepository; import com.totopia.server.modules.site.repository.BankAccountsRepository;
import com.totopia.server.modules.user.entity.GradeEntity; import com.totopia.server.modules.user.entity.GradeEntity;
@ -47,8 +45,8 @@ public class DbInitializer implements CommandLineRunner {
@Autowired @Autowired
GradeRepository gradeRepository; GradeRepository gradeRepository;
@Autowired // @Autowired
SportsRepository sportsRepository; // SportsRepository sportsRepository;
@Autowired @Autowired
LeagueRepository leagueRepository; LeagueRepository leagueRepository;
@ -66,9 +64,9 @@ public class DbInitializer implements CommandLineRunner {
this.initDbGrade(); this.initDbGrade();
} }
if (0 == sportsRepository.count()) { // if (0 == sportsRepository.count()) {
this.initDbSports(); // this.initDbSports();
} // }
if (0 == userRepository.count()) { if (0 == userRepository.count()) {
this.initDbUsers(); this.initDbUsers();
} }
@ -132,25 +130,26 @@ public class DbInitializer implements CommandLineRunner {
gradeRepository.save(grade); gradeRepository.save(grade);
} }
private void initDbSports() { // private void initDbSports() {
SportsEntity sportsEntity; // SportsTypeEntity sportsEntity;
sportsEntity = SportsEntity.builder().name(SportsName.SOCCER).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.SOCCER).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.BASEBALL).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.BASEBALL).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.BASKET_BALL).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.BASKET_BALL).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.E_SPORTS).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.E_SPORTS).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.HAND_BALL).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.HAND_BALL).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.TABLE_TENIS).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.TABLE_TENIS).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.VALLEY_BALL).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.VALLEY_BALL).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
sportsEntity = SportsEntity.builder().name(SportsName.TENNIS).build(); // sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.TENNIS).build();
sportsRepository.save(sportsEntity); // sportsRepository.save(sportsEntity);
} // }
private void initDbLeague() { private void initDbLeague() {
LeagueEntity leagueEntity; LeagueEntity leagueEntity;
@ -160,7 +159,8 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Bundesliga I") .engName("Germany Bundesliga I")
.korName("분데스리가") .korName("분데스리가")
.sevenMName("GER BI") .sevenMName("GER BI")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) // .sportsEntities(Stream.of(SportsTypeEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
.sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
leagueEntity = LeagueEntity.builder() leagueEntity = LeagueEntity.builder()
@ -169,7 +169,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Bundesliga II") .engName("Germany Bundesliga II")
.korName("분데스리가 2") .korName("분데스리가 2")
.sevenMName("GER B2") .sevenMName("GER B2")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -179,7 +179,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany 3.Liga") .engName("Germany 3.Liga")
.korName("3.리가") .korName("3.리가")
.sevenMName("GER L3") .sevenMName("GER L3")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
leagueEntity = LeagueEntity.builder() leagueEntity = LeagueEntity.builder()
@ -188,7 +188,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Regionalliga West") .engName("Germany Regionalliga West")
.korName("레기오날리가 웨스트") .korName("레기오날리가 웨스트")
.sevenMName("GER RL W") .sevenMName("GER RL W")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
leagueEntity = LeagueEntity.builder() leagueEntity = LeagueEntity.builder()
@ -197,7 +197,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Regionalliga North") .engName("Germany Regionalliga North")
.korName("레기오날리가 노스") .korName("레기오날리가 노스")
.sevenMName("GER RL N") .sevenMName("GER RL N")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -207,7 +207,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Regionalliga North East") .engName("Germany Regionalliga North East")
.korName("레기오날리가 노스 이스트") .korName("레기오날리가 노스 이스트")
.sevenMName("GER RL NE") .sevenMName("GER RL NE")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -217,7 +217,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Oberliga Rheinland-Pfalz/Saar") .engName("Germany Oberliga Rheinland-Pfalz/Saar")
.korName("오벨리가 Rheinland-Pfalz/Saar") .korName("오벨리가 Rheinland-Pfalz/Saar")
.sevenMName("GER OL R") .sevenMName("GER OL R")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -227,7 +227,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Regionalliga Bayern") .engName("Germany Regionalliga Bayern")
.korName("레기오날리가 바이에른") .korName("레기오날리가 바이에른")
.sevenMName("GER RL B") .sevenMName("GER RL B")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -237,7 +237,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Oberliga Hamburg") .engName("Germany Oberliga Hamburg")
.korName("오벨리가 함부르크") .korName("오벨리가 함부르크")
.sevenMName("GER OL H") .sevenMName("GER OL H")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -247,7 +247,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Oberliga Bayern North") .engName("Germany Oberliga Bayern North")
.korName("오벨리가 바이에른 노스") .korName("오벨리가 바이에른 노스")
.sevenMName("GER OL BN") .sevenMName("GER OL BN")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -257,7 +257,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Oberliga Baden-Wuerttemberg") .engName("Germany Oberliga Baden-Wuerttemberg")
.korName("오벨리가 Baden-Wuerttemberg") .korName("오벨리가 Baden-Wuerttemberg")
.sevenMName("GER OL BW") .sevenMName("GER OL BW")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -267,7 +267,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Oberliga Westfalen") .engName("Germany Oberliga Westfalen")
.korName("오벨리가 Westfalen") .korName("오벨리가 Westfalen")
.sevenMName("GER OL W") .sevenMName("GER OL W")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -277,7 +277,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Oberliga NOFV Sud") .engName("Germany Oberliga NOFV Sud")
.korName("오벨리가 NOFV Sud") .korName("오벨리가 NOFV Sud")
.sevenMName("GER OL NS") .sevenMName("GER OL NS")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -287,7 +287,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Germany Bundesliga Women") .engName("Germany Bundesliga Women")
.korName("우먼 분데스리가") .korName("우먼 분데스리가")
.sevenMName("Germany BW") .sevenMName("Germany BW")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -297,7 +297,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Barclays Premier League") .engName("Barclays Premier League")
.korName("프리미어 리그") .korName("프리미어 리그")
.sevenMName("Barclays PL") .sevenMName("Barclays PL")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -307,7 +307,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England League 2") .engName("England League 2")
.korName("리그 2") .korName("리그 2")
.sevenMName("UK L2") .sevenMName("UK L2")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -317,7 +317,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England National League") .engName("England National League")
.korName("내셔널 리그") .korName("내셔널 리그")
.sevenMName("UK NL") .sevenMName("UK NL")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -327,7 +327,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England National League North") .engName("England National League North")
.korName("내셔널 리그 노스") .korName("내셔널 리그 노스")
.sevenMName("UK NLN") .sevenMName("UK NLN")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -337,7 +337,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England National League South") .engName("England National League South")
.korName("내셔널 리그 사우스") .korName("내셔널 리그 사우스")
.sevenMName("UK NLS") .sevenMName("UK NLS")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -347,7 +347,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England Isthmian Premier Division") .engName("England Isthmian Premier Division")
.korName("이스미안 프리미어 디비전") .korName("이스미안 프리미어 디비전")
.sevenMName("Isthmian PD") .sevenMName("Isthmian PD")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -357,7 +357,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England Southern Premier League South") .engName("England Southern Premier League South")
.korName("사우던 프리미어 리그 사우스") .korName("사우던 프리미어 리그 사우스")
.sevenMName("England SPL S") .sevenMName("England SPL S")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -367,7 +367,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England Southern Premier League Central") .engName("England Southern Premier League Central")
.korName("사우던 프리미어 리그 센트럴") .korName("사우던 프리미어 리그 센트럴")
.sevenMName("England SPL C") .sevenMName("England SPL C")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -377,7 +377,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England Southern League Division One") .engName("England Southern League Division One")
.korName("사우던 리그 디비전 1") .korName("사우던 리그 디비전 1")
.sevenMName("UK SLD1") .sevenMName("UK SLD1")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -387,7 +387,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England U23 Development League") .engName("England U23 Development League")
.korName("유스 U23 디벨럽먼트 리그") .korName("유스 U23 디벨럽먼트 리그")
.sevenMName("England U23 DL") .sevenMName("England U23 DL")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -397,7 +397,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("Lancashire Senior Cup") .engName("Lancashire Senior Cup")
.korName("랭커셔 시니어 컵") .korName("랭커셔 시니어 컵")
.sevenMName("UK LS Cup") .sevenMName("UK LS Cup")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);
@ -407,7 +407,7 @@ public class DbInitializer implements CommandLineRunner {
.engName("England FA WSL") .engName("England FA WSL")
.korName("우먼 FA 슈퍼리그") .korName("우먼 FA 슈퍼리그")
.sevenMName("FA WSL") .sevenMName("FA WSL")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .sportsType(SportsTypeName.SOCCER)
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);

View File

@ -2,6 +2,7 @@ package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.DateAuditEntity; import com.totopia.server.commons.data.entity.DateAuditEntity;
import com.totopia.server.modules.game.type.BettingResultName; import com.totopia.server.modules.game.type.BettingResultName;
import com.totopia.server.modules.user.entity.RoleEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -9,6 +10,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.persistence.*; import javax.persistence.*;
import java.util.Set;
@Entity @Entity
@Table(name = "bet_history") @Table(name = "bet_history")
@ -28,9 +30,10 @@ public class BettingHistoryEntity extends DateAuditEntity {
@Column(name = "league_id", nullable = false) @Column(name = "league_id", nullable = false)
private Long league; private Long league;
@Basic
@Column(name = "sports_event_id", nullable = false) @ManyToMany(fetch = FetchType.EAGER)
private Long sportsEvent; @JoinTable(name = "betting_history_sports_event", joinColumns = @JoinColumn(name = "bet_history_id"), inverseJoinColumns = @JoinColumn(name = "sports_event_id"))
private Set<SportsEventEntity> sportsEvents;
@Basic @Basic
@Column(name = "user_id", nullable = false) @Column(name = "user_id", nullable = false)

View File

@ -1,11 +1,11 @@
package com.totopia.server.modules.game.entity; package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.DateAuditEntity; import com.totopia.server.commons.data.entity.DateAuditEntity;
import com.totopia.server.modules.game.type.SportsTypeName;
import lombok.*; import lombok.*;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import javax.persistence.*; import javax.persistence.*;
import java.util.Set;
@Entity @Entity
@Table(name = "league") @Table(name = "league")
@ -36,8 +36,7 @@ public class LeagueEntity extends DateAuditEntity {
@Column(name = "kor_country", nullable = true, length = 100) @Column(name = "kor_country", nullable = true, length = 100)
private String korCountry; private String korCountry;
@ManyToMany(fetch = FetchType.EAGER) @Enumerated(EnumType.STRING)
@JoinTable(name = "league_sports", joinColumns = @JoinColumn(name = "league_id"), inverseJoinColumns = @JoinColumn(name = "sports_id")) @Column(name = "sports_type", length = 60)
private Set<SportsEntity> sportsEntities; private SportsTypeName sportsType;
} }

View File

@ -0,0 +1,66 @@
package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.UserDateAuditEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;
@MappedSuperclass
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
public abstract class MiniGameEntity extends UserDateAuditEntity implements Serializable {
@Basic
@Column(name = "home_name", nullable = false, length = 200)
private String homeName;
@Basic
@Column(name = "draw_name", nullable = false, length = 200)
private String drawName;
@Basic
@Column(name = "away_name", nullable = false, length = 200)
private String awayName;
@Basic
@Column(name = "mini_game_type", nullable = false, length = 200)
private String miniGameType;
@Basic
@Column(name = "mini_game_round", nullable = false)
private Long miniGameRound;
@Basic
@Column(name = "result_status", nullable = false)
private Short resultStatus;
@Basic
@Column(name = "betting_status", nullable = false)
private Short bettingStatus;
@Basic
@Column(name = "match_date_time", nullable = false)
private Date matchDateTime;
@Basic
@Column(name = "home_odds", nullable = false)
private Float homeOdds;
@Basic
@Column(name = "draw_odds", nullable = false)
private Float drawOdds;
@Basic
@Column(name = "away_odds", nullable = false)
private Float awayOdds;
}

View File

@ -0,0 +1,26 @@
package com.totopia.server.modules.game.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "power_ball")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class PowerBallEntity extends MiniGameEntity {
@Id
@GeneratedValue(generator = "power_ball_generator")
@SequenceGenerator(name = "power_ball_generator", sequenceName = "power_ball_sequence", initialValue = 1)
private Long id;
}

View File

@ -1,29 +0,0 @@
package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.DateAuditEntity;
import com.totopia.server.modules.game.type.SportsName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "sports")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SportsEntity extends DateAuditEntity {
@Id
@GeneratedValue(generator = "sports_generator")
@SequenceGenerator(name = "sports_generator", sequenceName = "sports_sequence", initialValue = 1)
private Short id;
@Enumerated(EnumType.STRING)
@Column(name = "name", length = 60)
private SportsName name;
}

View File

@ -0,0 +1,90 @@
package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.DateAuditEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "sports_event")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SportsEventEntity extends DateAuditEntity {
@Id
@GeneratedValue(generator = "sports_event_generator")
@SequenceGenerator(name = "sports_event_generator", sequenceName = "sports_event_sequence", initialValue = 1)
private Long id;
@Basic
@Column(name = "match_date_time", nullable = false)
private Date matchDateTime;
@Basic
@Column(name = "result_status", nullable = false)
private Short resultStatus;
@Basic
@Column(name = "betting_status", nullable = false)
private Short bettingStatus;
@Basic
@Column(name = "game_way", nullable = false)
private Short gameWay;
@Basic
@Column(name = "game_type", nullable = false)
private Short gameType;
@Basic
@Column(name = "parse_status", nullable = false)
private Short parseStatus;
@Basic
@Column(name = "sports_name", nullable = false)
private String sportsName;
@Basic
@Column(name = "sports_kor_name", nullable = true)
private String sportsKorName;
@Basic
@Column(name = "match_etc", nullable = true)
private String matchEtc;
@Basic
@Column(name = "league_id", nullable = false)
private Long league;
@Basic
@Column(name = "home_team", nullable = false, length = 100)
private String homeTeam;
@Basic
@Column(name = "away_team", nullable = false, length = 100)
private String awayTeam;
@Basic
@Column(name = "home_odds", nullable = false)
private Float homeOdds;
@Basic
@Column(name = "draw_odds", nullable = false)
private Float drawOdds;
@Basic
@Column(name = "away_odds", nullable = false)
private Float awayOdds;
@Basic
@Column(name = "option_odds", nullable = false)
private Float optionOdds;
}

View File

@ -0,0 +1,48 @@
package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.DateAuditEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.util.Map;
@Entity
@Table(name = "sports_event_result")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SportsEventResultEntity extends DateAuditEntity {
@Id
@GeneratedValue(generator = "sports_event_result_generator")
@SequenceGenerator(name = "sports_event_result_generator", sequenceName = "sports_event_result_sequence", initialValue = 1)
private Long id;
// @Column(name = "event_id", unique = true)
// private Long eventId;
@Column(name = "status")
private Short status;
@Column(name = "home_full_time_score")
private Short homeFullTimeScore;
@Column(name = "home_final_score")
private Short homeFinalScore;
@Column(name = "away_full_time_score")
private Short awayFullTimeScore;
@Column(name = "away_final_score")
private Short awayFinalScore;
@Column(name = "score_Info", columnDefinition = "json")
private Map<String, Object> scoreInfo;
}

View File

@ -0,0 +1,39 @@
package com.totopia.server.modules.game.entity;
import com.totopia.server.commons.data.entity.DateAuditEntity;
import com.totopia.server.modules.game.type.SportsTypeName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "sports_team_result")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SportsTeamEntity extends DateAuditEntity {
@Id
@GeneratedValue(generator = "sports_team_generator")
@SequenceGenerator(name = "sports_team_generator", sequenceName = "sports_team_sequence", initialValue = 1)
private Long id;
@Column(name = "eng_name", nullable = false, length = 200)
private String engName;
@Column(name = "kor_name", nullable = true, length = 200)
private String korName;
@Column(name = "country_code", nullable = true, length = 50)
private String countryCode;
@Enumerated(EnumType.STRING)
@Column(name = "sports_type", length = 60)
private SportsTypeName sportsType;
}

View File

@ -1,7 +0,0 @@
package com.totopia.server.modules.game.repository;
import com.totopia.server.modules.game.entity.SportsEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface SportsRepository extends JpaRepository<SportsEntity, Short> {
}

View File

@ -1,41 +0,0 @@
package com.totopia.server.modules.game.service;
import com.totopia.server.commons.exception.ResourceNotFoundException;
import com.totopia.server.modules.game.entity.SportsEntity;
import com.totopia.server.modules.game.repository.SportsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@Service
public class SportsService {
@Autowired
private SportsRepository sportsRepository;
public Page<SportsEntity> getAllSportsByPageable(Pageable pageable) {
Page<SportsEntity> entities = null;
entities = this.sportsRepository.findAll(pageable);
return entities;
}
public SportsEntity getSportsById(Short sportId) {
return this.sportsRepository.findById(sportId).orElseThrow(null);
}
public SportsEntity save(SportsEntity sportsEntity) {
return this.sportsRepository.save(sportsEntity);
}
public SportsEntity modify(SportsEntity sportsEntity) {
return this.sportsRepository.save(sportsEntity);
}
public Short remove(Short sportsId) {
return sportsRepository.findById(sportsId).map(sports -> {
sportsRepository.delete(sports);
return sportsId;
}).orElseThrow(() -> new ResourceNotFoundException("Sports", "sportsId", sportsId));
}
}

View File

@ -1,12 +1,12 @@
package com.totopia.server.modules.game.type; package com.totopia.server.modules.game.type;
public enum SportsName { public enum SportsTypeName {
SOCCER, SOCCER,
BASEBALL, BASEBALL,
BASKET_BALL, BASKET_BALL,
E_SPORTS, E_SPORTS,
TENNIS, TENNIS,
TABLE_TENIS, TABLE_TENNIS,
VALLEY_BALL, VALLEY_BALL,
HAND_BALL HAND_BALL
} }

View File

@ -16,7 +16,7 @@ import javax.persistence.*;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class PopupConfig extends UserDateAuditEntity { public class PopupConfigEntity extends UserDateAuditEntity {
@Id @Id
@GeneratedValue(generator = "bet_history_generator") @GeneratedValue(generator = "bet_history_generator")

View File

@ -0,0 +1,39 @@
package com.totopia.server.modules.special.entity;
import com.totopia.server.commons.data.entity.UserDateAuditEntity;
import com.totopia.server.modules.special.type.AlertConfigName;
import lombok.*;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "alert_config")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
public class AlertConfigEntity extends UserDateAuditEntity {
@Id
@GeneratedValue(generator = "alert_config_generator")
@SequenceGenerator(name = "alert_config_generator", sequenceName = "alert_config_sequence", initialValue = 1)
private Short id;
@Basic
@Column(name = "name", nullable = false, length = 100)
private String name;
@Basic
@Column(name = "file_path", nullable = false, length = 200)
private String filePath;
@Basic
@Column(name = "file_name", nullable = false, length = 200)
private String fileName;
@Enumerated(EnumType.STRING)
@Column(name = "alert_type", length = 60)
private AlertConfigName alertType;
}

View File

@ -0,0 +1,30 @@
package com.totopia.server.modules.special.entity;
import com.totopia.server.commons.data.entity.UserDateAuditEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "check_notice")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
public class CheckNoticeEntity extends UserDateAuditEntity {
@Id
@GeneratedValue(generator = "check_notice_generator")
@SequenceGenerator(name = "check_notice_generator", sequenceName = "check_notice_sequence", initialValue = 1)
private Short id;
@Basic
@Column(name = "enable", nullable = false)
private Boolean enable = true;
@Basic
@Column(name = "contents", nullable = true, length = 2000)
private String contents;
}

View File

@ -41,6 +41,6 @@ public class FixBonusEntity extends DateAuditEntity {
private Short folder; private Short folder;
@Basic @Basic
@Column(name = "allow", nullable = true) @Column(name = "allow", nullable = false)
private Boolean allow = true; private Boolean allow = true;
} }

View File

@ -0,0 +1,34 @@
package com.totopia.server.modules.special.entity;
import com.totopia.server.commons.data.entity.UserDateAuditEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "martin_config")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
public class MartinConfigEntity extends UserDateAuditEntity {
@Id
@GeneratedValue(generator = "martin_config_generator")
@SequenceGenerator(name = "martin_config_generator", sequenceName = "martin_config_sequence", initialValue = 1)
private Short id;
@Basic
@Column(name = "name", nullable = false, length = 100)
private String name;
@Basic
@Column(name = "martin_enable", nullable = false)
private Boolean refEnable = true;
@Basic
@Column(name = "betting_odds", nullable = false)
private Float bettingOdds;
}

View File

@ -0,0 +1,34 @@
package com.totopia.server.modules.special.entity;
import com.totopia.server.commons.data.entity.UserDateAuditEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
@Entity
@Table(name = "roulette_config")
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
public class RouletteConfigEntity extends UserDateAuditEntity {
@Id
@GeneratedValue(generator = "roulette_config_generator")
@SequenceGenerator(name = "roulette_config_generator", sequenceName = "roulette_config_sequence", initialValue = 1)
private Short id;
@Basic
@Column(name = "price", nullable = false)
private Integer price;
@Basic
@Column(name = "percentage", nullable = false)
private Integer percentage;
@Basic
@Column(name = "price_won", nullable = false, length = 64)
private String priceWon;
}

View File

@ -0,0 +1,14 @@
package com.totopia.server.modules.special.type;
public enum AlertConfigName {
ALERT_DEPOSIT,
ALERT_WITHDRAW,
ALERT_QNA_USER,
ALERT_NEW_USER,
ALERT_NEW_BOARD,
ALERT_WARNING_BETTING_LIMIT,
ALERT_BETTING,
ALERT_WATCH_USER,
ALERT_SEND_MESSAGE,
ALERT_ANSWER_MESSAGE
}

View File

@ -49,6 +49,6 @@ public class CommissionEntity extends UserDateAuditEntity {
private String miniGameRaffleFees; private String miniGameRaffleFees;
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
@Column(name = "type", length = 60) @Column(name = "commission_type", length = 60)
private CommissionName type; private CommissionName commissionType;
} }

View File

@ -1,9 +1,7 @@
package com.totopia.server.modules.game.repository; package com.totopia.server.modules.game.repository;
import com.totopia.server.modules.game.entity.LeagueEntity; import com.totopia.server.modules.game.entity.LeagueEntity;
import com.totopia.server.modules.game.entity.SportsEntity;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -14,8 +12,6 @@ import java.util.HashSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static org.junit.Assert.*;
//@Ignore //@Ignore
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@ -36,7 +32,7 @@ public class LeagueRepositoryTest {
.engName("Germany Bundesliga I") .engName("Germany Bundesliga I")
.korName("분데스리가") .korName("분데스리가")
.sevenMName("GER BI") .sevenMName("GER BI")
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) // .sportsEntities(Stream.of(SportsTypeEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
.build(); .build();
this.leagueRepository.save(leagueEntity); this.leagueRepository.save(leagueEntity);