From b7cb3cb6ea50828246a3f47bd1bc05e0cc28d801 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sat, 25 Oct 2025 08:00:00 +0800 Subject: [PATCH] [-] Drop ng words and unused repo functinos --- .../icu/samnyan/aqua/sega/diva/DivaRepos.kt | 34 ++----------------- .../aqua/sega/diva/handler/InitHandlers.kt | 3 -- .../diva/handler/databank/PvListHandler.kt | 12 +++---- .../sega/diva/handler/user/StartHandler.kt | 27 +++++---------- .../sega/diva/model/gamedata/NgWords.java | 29 ---------------- .../db/80/V1000_60__drop_the_codebase.sql | 2 ++ 6 files changed, 19 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/icu/samnyan/aqua/sega/diva/model/gamedata/NgWords.java diff --git a/src/main/java/icu/samnyan/aqua/sega/diva/DivaRepos.kt b/src/main/java/icu/samnyan/aqua/sega/diva/DivaRepos.kt index 7e1121e3..ad295e91 100644 --- a/src/main/java/icu/samnyan/aqua/sega/diva/DivaRepos.kt +++ b/src/main/java/icu/samnyan/aqua/sega/diva/DivaRepos.kt @@ -4,8 +4,6 @@ import icu.samnyan.aqua.sega.diva.model.common.Difficulty import icu.samnyan.aqua.sega.diva.model.common.Edition import icu.samnyan.aqua.sega.diva.model.gamedata.* import icu.samnyan.aqua.sega.diva.model.userdata.* -import org.springframework.data.domain.Page -import org.springframework.data.domain.Pageable import org.springframework.data.jpa.repository.JpaRepository import org.springframework.data.jpa.repository.Query import org.springframework.data.repository.query.Param @@ -20,7 +18,6 @@ class DivaGameRepos( val module: DivaModuleRepository, val pv: DivaPvRepository, val festa: FestaRepository, - val ngWords: NgWordsRepository, val pvEntry: PvEntryRepository ) @@ -58,9 +55,6 @@ interface FestaRepository : JpaRepository { fun findTop2ByEnableOrderByCreateDateDesc(enable: Boolean): MutableList } -@Repository -interface NgWordsRepository : JpaRepository - @Repository interface PvEntryRepository : JpaRepository { fun findByDifficulty(difficulty: Difficulty): MutableList @@ -81,8 +75,6 @@ interface GameSessionRepository : JpaRepository { interface PlayerCustomizeRepository : JpaRepository { fun findByPdId(profile: PlayerProfile): MutableList - fun findByPdId_PdId(pdId: Long, page: Pageable): Page - fun findByPdIdAndCustomizeId(currentProfile: PlayerProfile, parseInt: Int): Optional } @@ -99,8 +91,6 @@ interface PlayerProfileRepository : JpaRepository { @Repository interface PlayerPvCustomizeRepository : JpaRepository { fun findByPdIdAndPvId(profile: PlayerProfile, pvId: Int): Optional - - fun findByPdId_PdIdAndPvId(pdId: Long, pvId: Int): Optional } @Repository @@ -134,8 +124,6 @@ interface PlayerPvRecordRepository : JpaRepository { fun findByPdId(profile: PlayerProfile): MutableList - fun findByIdAndPdId_PdId(id: Long, pdId: Long): Optional - fun findByPdIdAndEdition(profile: PlayerProfile, edition: Edition): MutableList fun findTop3ByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc( @@ -143,32 +131,14 @@ interface PlayerPvRecordRepository : JpaRepository { edition: Edition, difficulty: Difficulty ): MutableList - - fun findByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc( - pvId: Int, - edition: Edition, - difficulty: Difficulty, - page: Pageable - ): Page - - fun findByPdId_PdIdOrderByPvId(pdId: Long, page: Pageable): Page - - fun findByPdId_PdIdAndPvId(pdId: Long, pvId: Int): MutableList } -interface PlayerScreenShotRepository : JpaRepository { - fun findByPdId_PdId(pdId: Long): MutableList - fun findByFileName(fileName: String): Optional -} +interface PlayerScreenShotRepository : JpaRepository @Repository -interface PlayLogRepository : JpaRepository { - fun findByPdId_PdIdOrderByDateTimeDesc(pdId: Long, page: Pageable): Page -} +interface PlayLogRepository : JpaRepository @Repository interface PlayerModuleRepository : JpaRepository { fun findByPdId(profile: PlayerProfile): MutableList - - fun findByPdId_PdId(pdId: Long, pageable: Pageable): Page } \ No newline at end of file diff --git a/src/main/java/icu/samnyan/aqua/sega/diva/handler/InitHandlers.kt b/src/main/java/icu/samnyan/aqua/sega/diva/handler/InitHandlers.kt index 921a4f41..a0fa283e 100644 --- a/src/main/java/icu/samnyan/aqua/sega/diva/handler/InitHandlers.kt +++ b/src/main/java/icu/samnyan/aqua/sega/diva/handler/InitHandlers.kt @@ -36,9 +36,6 @@ class AttendHandler { ) } -/** - * @author samnyan (privateamusement@protonmail.com) - */ @Component class PingHandler(val rp: PropertyEntryRepository) { fun handle(request: BaseRequest): Any { diff --git a/src/main/java/icu/samnyan/aqua/sega/diva/handler/databank/PvListHandler.kt b/src/main/java/icu/samnyan/aqua/sega/diva/handler/databank/PvListHandler.kt index 7c244b25..edd86b00 100644 --- a/src/main/java/icu/samnyan/aqua/sega/diva/handler/databank/PvListHandler.kt +++ b/src/main/java/icu/samnyan/aqua/sega/diva/handler/databank/PvListHandler.kt @@ -1,6 +1,6 @@ package icu.samnyan.aqua.sega.diva.handler.databank -import icu.samnyan.aqua.sega.diva.PvEntryRepository +import icu.samnyan.aqua.sega.diva.DivaRepos import icu.samnyan.aqua.sega.diva.model.common.Difficulty import icu.samnyan.aqua.sega.diva.model.gamedata.PvEntry import icu.samnyan.aqua.sega.diva.model.request.BaseRequest @@ -15,16 +15,16 @@ import java.util.function.Consumer * @author samnyan (privateamusement@protonmail.com) */ @Component -class PvListHandler(private val pvEntryRepository: PvEntryRepository) { +class PvListHandler(val db: DivaRepos) { private val df: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") fun handle(request: BaseRequest): Any { val sb = StringBuilder() - val easyList = pvEntryRepository.findByDifficulty(Difficulty.EASY) - val normalList = pvEntryRepository.findByDifficulty(Difficulty.NORMAL) - val hardList = pvEntryRepository.findByDifficulty(Difficulty.HARD) - val extremeList = pvEntryRepository.findByDifficulty(Difficulty.EXTREME) + val easyList = db.g.pvEntry.findByDifficulty(Difficulty.EASY) + val normalList = db.g.pvEntry.findByDifficulty(Difficulty.NORMAL) + val hardList = db.g.pvEntry.findByDifficulty(Difficulty.HARD) + val extremeList = db.g.pvEntry.findByDifficulty(Difficulty.EXTREME) sb.append(encode(difficultyString(easyList))).append(",") sb.append(encode(difficultyString(normalList))).append(",") diff --git a/src/main/java/icu/samnyan/aqua/sega/diva/handler/user/StartHandler.kt b/src/main/java/icu/samnyan/aqua/sega/diva/handler/user/StartHandler.kt index 80b83f0f..f78e56af 100644 --- a/src/main/java/icu/samnyan/aqua/sega/diva/handler/user/StartHandler.kt +++ b/src/main/java/icu/samnyan/aqua/sega/diva/handler/user/StartHandler.kt @@ -1,9 +1,6 @@ package icu.samnyan.aqua.sega.diva.handler.user import icu.samnyan.aqua.sega.diva.DivaRepos -import icu.samnyan.aqua.sega.diva.PlayerCustomizeService -import icu.samnyan.aqua.sega.diva.PlayerModuleService -import icu.samnyan.aqua.sega.diva.PlayerProfileService import icu.samnyan.aqua.sega.diva.model.common.* import icu.samnyan.aqua.sega.diva.model.common.collection.ClearTally import icu.samnyan.aqua.sega.diva.model.request.user.StartRequest @@ -26,12 +23,7 @@ import java.util.stream.Collectors * @author samnyan (privateamusement@protonmail.com) */ @Component -class StartHandler( - private val playerProfileService: PlayerProfileService, - private val playerCustomizeService: PlayerCustomizeService, - private val playerModuleService: PlayerModuleService, - val db: DivaRepos -) { +class StartHandler(val db: DivaRepos) { fun handle(request: StartRequest): Any { val profile = db.profile.findByPdId(request.getPd_id()).orElseThrow( Supplier { ProfileNotFoundException() }) @@ -41,8 +33,8 @@ class StartHandler( session.startMode = StartMode.START db.gameSession.save(session) - val module_have = playerModuleService.getModuleHaveString(profile) - val customize_have = playerCustomizeService.getModuleHaveString(profile) + val module_have = db.s.module.getModuleHaveString(profile) + val customize_have = db.s.customize.getModuleHaveString(profile) val contestResult = getContestResult(profile) @@ -86,11 +78,11 @@ class StartHandler( profile.nextPvId, profile.nextDifficulty, profile.nextEdition, - contestResult.get("cv_cid"), // contest progress - contestResult.get("cv_sc"), - contestResult.get("cv_rr"), - contestResult.get("cv_bv"), - contestResult.get("cv_bf"), + contestResult["cv_cid"], // contest progress + contestResult["cv_sc"], + contestResult["cv_rr"], + contestResult["cv_bv"], + contestResult["cv_bf"], if (profile.isContestNowPlayingEnable) profile.contestNowPlayingId else -1, profile.contestNowPlayingValue, profile.contestNowPlayingResultRank, @@ -99,8 +91,7 @@ class StartHandler( profile.myList1, profile.myList2, null, - null, // getDummyString("-1", 40), - // getDummyString("-1", 40), + null, border.toString(), profile.isShowInterimRanking, profile.isShowClearStatus, diff --git a/src/main/java/icu/samnyan/aqua/sega/diva/model/gamedata/NgWords.java b/src/main/java/icu/samnyan/aqua/sega/diva/model/gamedata/NgWords.java deleted file mode 100644 index c8be4f17..00000000 --- a/src/main/java/icu/samnyan/aqua/sega/diva/model/gamedata/NgWords.java +++ /dev/null @@ -1,29 +0,0 @@ -package icu.samnyan.aqua.sega.diva.model.gamedata; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import jakarta.persistence.*; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -/** - * @author samnyan (privateamusement@protonmail.com) - */ -@Entity(name = "DivaNgWords") -@Table(name = "diva_ng_words") -@Data -@AllArgsConstructor -@NoArgsConstructor -public class NgWords implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @JsonIgnore - private int id; - - private String word; -} diff --git a/src/main/resources/db/80/V1000_60__drop_the_codebase.sql b/src/main/resources/db/80/V1000_60__drop_the_codebase.sql index 291e0a3a..6e37d855 100644 --- a/src/main/resources/db/80/V1000_60__drop_the_codebase.sql +++ b/src/main/resources/db/80/V1000_60__drop_the_codebase.sql @@ -40,3 +40,5 @@ drop table chuni_user_data; drop table sega_game_version; +drop table diva_ng_words; +