dbinit modify
This commit is contained in:
parent
3873ef7754
commit
78037ab0d4
|
@ -1,7 +1,9 @@
|
||||||
package com.totopia.server.init;
|
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.SportsEntity;
|
import com.totopia.server.modules.game.entity.SportsEntity;
|
||||||
|
import com.totopia.server.modules.game.repository.LeagueRepository;
|
||||||
import com.totopia.server.modules.game.repository.SportsRepository;
|
import com.totopia.server.modules.game.repository.SportsRepository;
|
||||||
import com.totopia.server.modules.game.type.SportsName;
|
import com.totopia.server.modules.game.type.SportsName;
|
||||||
import com.totopia.server.modules.user.entity.GradeEntity;
|
import com.totopia.server.modules.user.entity.GradeEntity;
|
||||||
|
@ -46,10 +48,33 @@ public class DbInitializer implements CommandLineRunner {
|
||||||
@Autowired
|
@Autowired
|
||||||
SportsRepository sportsRepository;
|
SportsRepository sportsRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LeagueRepository leagueRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... strings) throws Exception {
|
public void run(String... strings) throws Exception {
|
||||||
if (0 == roleRepository.count()) {
|
if (0 == roleRepository.count()) {
|
||||||
|
this.initDbRole();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == gradeRepository.count()) {
|
||||||
|
this.initDbGrade();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == sportsRepository.count()) {
|
||||||
|
this.initDbSports();
|
||||||
|
}
|
||||||
|
if (0 == userRepository.count()) {
|
||||||
|
this.initDbUsers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == leagueRepository.count()) {
|
||||||
|
this.initDbLeague();
|
||||||
|
}
|
||||||
|
log.debug("-- Database has been initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDbRole() {
|
||||||
RoleEntity role;
|
RoleEntity role;
|
||||||
role = RoleEntity.builder().name(RoleName.ROLE_USER).build();
|
role = RoleEntity.builder().name(RoleName.ROLE_USER).build();
|
||||||
roleRepository.save(role);
|
roleRepository.save(role);
|
||||||
|
@ -63,41 +88,7 @@ public class DbInitializer implements CommandLineRunner {
|
||||||
roleRepository.save(role);
|
roleRepository.save(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == gradeRepository.count()) {
|
private void initDbUsers() {
|
||||||
GradeEntity grade;
|
|
||||||
grade = GradeEntity.builder().name(GradeName.BAD_USER).build();
|
|
||||||
gradeRepository.save(grade);
|
|
||||||
grade = GradeEntity.builder().name(GradeName.NORMAL_USER).build();
|
|
||||||
gradeRepository.save(grade);
|
|
||||||
grade = GradeEntity.builder().name(GradeName.REGULAR_USER).build();
|
|
||||||
gradeRepository.save(grade);
|
|
||||||
grade = GradeEntity.builder().name(GradeName.VIP_USER).build();
|
|
||||||
gradeRepository.save(grade);
|
|
||||||
grade = GradeEntity.builder().name(GradeName.PLATINUM_USER).build();
|
|
||||||
gradeRepository.save(grade);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 == sportsRepository.count()) {
|
|
||||||
SportsEntity sportsEntity;
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.SOCCER).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.BASEBALL).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.BASKET_BALL).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.E_SPORTS).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.HAND_BALL).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.TABLE_TENIS).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.VALLEY_BALL).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
sportsEntity = SportsEntity.builder().name(SportsName.TENNIS).build();
|
|
||||||
sportsRepository.save(sportsEntity);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (0 == userRepository.count()) {
|
|
||||||
UserEntity user;
|
UserEntity user;
|
||||||
user = UserEntity.builder().username("admin").password(passwordEncoder.encode("admin")).nickname("admin")
|
user = UserEntity.builder().username("admin").password(passwordEncoder.encode("admin")).nickname("admin")
|
||||||
.email("admin@example.com").block(false).resetCount(0L).sendEmail(true).roles(Stream.of(RoleEntity.builder().id(Short.valueOf((short) 1)).build())
|
.email("admin@example.com").block(false).resetCount(0L).sendEmail(true).roles(Stream.of(RoleEntity.builder().id(Short.valueOf((short) 1)).build())
|
||||||
|
@ -118,7 +109,298 @@ public class DbInitializer implements CommandLineRunner {
|
||||||
|
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
}
|
}
|
||||||
|
private void initDbGrade() {
|
||||||
|
GradeEntity grade;
|
||||||
|
grade = GradeEntity.builder().name(GradeName.BAD_USER).build();
|
||||||
|
gradeRepository.save(grade);
|
||||||
|
grade = GradeEntity.builder().name(GradeName.NORMAL_USER).build();
|
||||||
|
gradeRepository.save(grade);
|
||||||
|
grade = GradeEntity.builder().name(GradeName.REGULAR_USER).build();
|
||||||
|
gradeRepository.save(grade);
|
||||||
|
grade = GradeEntity.builder().name(GradeName.VIP_USER).build();
|
||||||
|
gradeRepository.save(grade);
|
||||||
|
grade = GradeEntity.builder().name(GradeName.PLATINUM_USER).build();
|
||||||
|
gradeRepository.save(grade);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDbSports() {
|
||||||
|
SportsEntity sportsEntity;
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.SOCCER).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.BASEBALL).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.BASKET_BALL).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.E_SPORTS).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.HAND_BALL).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.TABLE_TENIS).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.VALLEY_BALL).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
sportsEntity = SportsEntity.builder().name(SportsName.TENNIS).build();
|
||||||
|
sportsRepository.save(sportsEntity);
|
||||||
|
}
|
||||||
|
private void initDbLeague() {
|
||||||
|
LeagueEntity leagueEntity;
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Bundesliga I")
|
||||||
|
.kor_name("분데스리가")
|
||||||
|
.sevenMName("GER BI")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Bundesliga II")
|
||||||
|
.kor_name("분데스리가 2")
|
||||||
|
.sevenMName("GER B2")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany 3.Liga")
|
||||||
|
.kor_name("3.리가")
|
||||||
|
.sevenMName("GER L3")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Regionalliga West")
|
||||||
|
.kor_name("레기오날리가 웨스트")
|
||||||
|
.sevenMName("GER RL W")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Regionalliga North")
|
||||||
|
.kor_name("레기오날리가 노스")
|
||||||
|
.sevenMName("GER RL N")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Regionalliga North East")
|
||||||
|
.kor_name("레기오날리가 노스 이스트")
|
||||||
|
.sevenMName("GER RL NE")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Oberliga Rheinland-Pfalz/Saar")
|
||||||
|
.kor_name("오벨리가 Rheinland-Pfalz/Saar")
|
||||||
|
.sevenMName("GER OL R")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Regionalliga Bayern")
|
||||||
|
.kor_name("레기오날리가 바이에른")
|
||||||
|
.sevenMName("GER RL B")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Oberliga Hamburg")
|
||||||
|
.kor_name("오벨리가 함부르크")
|
||||||
|
.sevenMName("GER OL H")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Oberliga Bayern North")
|
||||||
|
.kor_name("오벨리가 바이에른 노스")
|
||||||
|
.sevenMName("GER OL BN")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Oberliga Baden-Wuerttemberg")
|
||||||
|
.kor_name("오벨리가 Baden-Wuerttemberg")
|
||||||
|
.sevenMName("GER OL BW")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Oberliga Westfalen")
|
||||||
|
.kor_name("오벨리가 Westfalen")
|
||||||
|
.sevenMName("GER OL W")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Oberliga NOFV Sud")
|
||||||
|
.kor_name("오벨리가 NOFV Sud")
|
||||||
|
.sevenMName("GER OL NS")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("Germany")
|
||||||
|
.korCountry("독일")
|
||||||
|
.eng_name("Germany Bundesliga Women")
|
||||||
|
.kor_name("우먼 분데스리가")
|
||||||
|
.sevenMName("Germany BW")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("Barclays Premier League")
|
||||||
|
.kor_name("프리미어 리그")
|
||||||
|
.sevenMName("Barclays PL")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England League 2")
|
||||||
|
.kor_name("리그 2")
|
||||||
|
.sevenMName("UK L2")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England National League")
|
||||||
|
.kor_name("내셔널 리그")
|
||||||
|
.sevenMName("UK NL")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England National League North")
|
||||||
|
.kor_name("내셔널 리그 노스")
|
||||||
|
.sevenMName("UK NLN")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England National League South")
|
||||||
|
.kor_name("내셔널 리그 사우스")
|
||||||
|
.sevenMName("UK NLS")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England Isthmian Premier Division")
|
||||||
|
.kor_name("이스미안 프리미어 디비전")
|
||||||
|
.sevenMName("Isthmian PD")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England Southern Premier League South")
|
||||||
|
.kor_name("사우던 프리미어 리그 사우스")
|
||||||
|
.sevenMName("England SPL S")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England Southern Premier League Central")
|
||||||
|
.kor_name("사우던 프리미어 리그 센트럴")
|
||||||
|
.sevenMName("England SPL C")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England Southern League Division One")
|
||||||
|
.kor_name("사우던 리그 디비전 1")
|
||||||
|
.sevenMName("UK SLD1")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England U23 Development League")
|
||||||
|
.kor_name("유스 U23 디벨럽먼트 리그")
|
||||||
|
.sevenMName("England U23 DL")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("Lancashire Senior Cup")
|
||||||
|
.kor_name("랭커셔 시니어 컵")
|
||||||
|
.sevenMName("UK LS Cup")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
|
leagueEntity = LeagueEntity.builder()
|
||||||
|
.engCountry("England")
|
||||||
|
.korCountry("잉글랜드")
|
||||||
|
.eng_name("England FA WSL")
|
||||||
|
.kor_name("우먼 FA 슈퍼리그")
|
||||||
|
.sevenMName("FA WSL")
|
||||||
|
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
|
.build();
|
||||||
|
this.leagueRepository.save(leagueEntity);
|
||||||
|
|
||||||
log.debug("-- Database has been initialized");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,286 +0,0 @@
|
||||||
package com.totopia.server.init;
|
|
||||||
|
|
||||||
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 lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@ConditionalOnProperty(name = "app.db-init", havingValue = "true")
|
|
||||||
@Slf4j
|
|
||||||
public class LeagueDbInitializer implements CommandLineRunner {
|
|
||||||
@Autowired
|
|
||||||
LeagueRepository leagueRepository;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(String... strings) throws Exception {
|
|
||||||
if (0 == leagueRepository.count()) {
|
|
||||||
LeagueEntity leagueEntity;
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Bundesliga I")
|
|
||||||
.kor_name("분데스리가")
|
|
||||||
.sevenMName("GER BI")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Bundesliga II")
|
|
||||||
.kor_name("분데스리가 2")
|
|
||||||
.sevenMName("GER B2")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany 3.Liga")
|
|
||||||
.kor_name("3.리가")
|
|
||||||
.sevenMName("GER L3")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Regionalliga West")
|
|
||||||
.kor_name("레기오날리가 웨스트")
|
|
||||||
.sevenMName("GER RL W")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Regionalliga North")
|
|
||||||
.kor_name("레기오날리가 노스")
|
|
||||||
.sevenMName("GER RL N")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Regionalliga North East")
|
|
||||||
.kor_name("레기오날리가 노스 이스트")
|
|
||||||
.sevenMName("GER RL NE")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Oberliga Rheinland-Pfalz/Saar")
|
|
||||||
.kor_name("오벨리가 Rheinland-Pfalz/Saar")
|
|
||||||
.sevenMName("GER OL R")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Regionalliga Bayern")
|
|
||||||
.kor_name("레기오날리가 바이에른")
|
|
||||||
.sevenMName("GER RL B")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Oberliga Hamburg")
|
|
||||||
.kor_name("오벨리가 함부르크")
|
|
||||||
.sevenMName("GER OL H")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Oberliga Bayern North")
|
|
||||||
.kor_name("오벨리가 바이에른 노스")
|
|
||||||
.sevenMName("GER OL BN")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Oberliga Baden-Wuerttemberg")
|
|
||||||
.kor_name("오벨리가 Baden-Wuerttemberg")
|
|
||||||
.sevenMName("GER OL BW")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Oberliga Westfalen")
|
|
||||||
.kor_name("오벨리가 Westfalen")
|
|
||||||
.sevenMName("GER OL W")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Oberliga NOFV Sud")
|
|
||||||
.kor_name("오벨리가 NOFV Sud")
|
|
||||||
.sevenMName("GER OL NS")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("Germany")
|
|
||||||
.korCountry("독일")
|
|
||||||
.eng_name("Germany Bundesliga Women")
|
|
||||||
.kor_name("우먼 분데스리가")
|
|
||||||
.sevenMName("Germany BW")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("Barclays Premier League")
|
|
||||||
.kor_name("프리미어 리그")
|
|
||||||
.sevenMName("Barclays PL")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England League 2")
|
|
||||||
.kor_name("리그 2")
|
|
||||||
.sevenMName("UK L2")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England National League")
|
|
||||||
.kor_name("내셔널 리그")
|
|
||||||
.sevenMName("UK NL")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England National League North")
|
|
||||||
.kor_name("내셔널 리그 노스")
|
|
||||||
.sevenMName("UK NLN")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England National League South")
|
|
||||||
.kor_name("내셔널 리그 사우스")
|
|
||||||
.sevenMName("UK NLS")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England Isthmian Premier Division")
|
|
||||||
.kor_name("이스미안 프리미어 디비전")
|
|
||||||
.sevenMName("Isthmian PD")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England Southern Premier League South")
|
|
||||||
.kor_name("사우던 프리미어 리그 사우스")
|
|
||||||
.sevenMName("England SPL S")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England Southern Premier League Central")
|
|
||||||
.kor_name("사우던 프리미어 리그 센트럴")
|
|
||||||
.sevenMName("England SPL C")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England Southern League Division One")
|
|
||||||
.kor_name("사우던 리그 디비전 1")
|
|
||||||
.sevenMName("UK SLD1")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England U23 Development League")
|
|
||||||
.kor_name("유스 U23 디벨럽먼트 리그")
|
|
||||||
.sevenMName("England U23 DL")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("Lancashire Senior Cup")
|
|
||||||
.kor_name("랭커셔 시니어 컵")
|
|
||||||
.sevenMName("UK LS Cup")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
|
|
||||||
leagueEntity = LeagueEntity.builder()
|
|
||||||
.engCountry("England")
|
|
||||||
.korCountry("잉글랜드")
|
|
||||||
.eng_name("England FA WSL")
|
|
||||||
.kor_name("우먼 FA 슈퍼리그")
|
|
||||||
.sevenMName("FA WSL")
|
|
||||||
.sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new)))
|
|
||||||
.build();
|
|
||||||
this.leagueRepository.save(leagueEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user