[-] Drop ng words and unused repo functinos

This commit is contained in:
Azalea 2025-10-25 08:00:00 +08:00
parent 619caec2ff
commit b7cb3cb6ea
6 changed files with 19 additions and 88 deletions

View File

@ -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<Festa, Int> {
fun findTop2ByEnableOrderByCreateDateDesc(enable: Boolean): MutableList<Festa>
}
@Repository
interface NgWordsRepository : JpaRepository<NgWords, Int>
@Repository
interface PvEntryRepository : JpaRepository<PvEntry, Int> {
fun findByDifficulty(difficulty: Difficulty): MutableList<PvEntry>
@ -81,8 +75,6 @@ interface GameSessionRepository : JpaRepository<GameSession, Long> {
interface PlayerCustomizeRepository : JpaRepository<PlayerCustomize, Long> {
fun findByPdId(profile: PlayerProfile): MutableList<PlayerCustomize>
fun findByPdId_PdId(pdId: Long, page: Pageable): Page<PlayerCustomize>
fun findByPdIdAndCustomizeId(currentProfile: PlayerProfile, parseInt: Int): Optional<PlayerCustomize>
}
@ -99,8 +91,6 @@ interface PlayerProfileRepository : JpaRepository<PlayerProfile, Long> {
@Repository
interface PlayerPvCustomizeRepository : JpaRepository<PlayerPvCustomize, Long> {
fun findByPdIdAndPvId(profile: PlayerProfile, pvId: Int): Optional<PlayerPvCustomize>
fun findByPdId_PdIdAndPvId(pdId: Long, pvId: Int): Optional<PlayerPvCustomize>
}
@Repository
@ -134,8 +124,6 @@ interface PlayerPvRecordRepository : JpaRepository<PlayerPvRecord, Long> {
fun findByPdId(profile: PlayerProfile): MutableList<PlayerPvRecord>
fun findByIdAndPdId_PdId(id: Long, pdId: Long): Optional<PlayerPvRecord>
fun findByPdIdAndEdition(profile: PlayerProfile, edition: Edition): MutableList<PlayerPvRecord>
fun findTop3ByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(
@ -143,32 +131,14 @@ interface PlayerPvRecordRepository : JpaRepository<PlayerPvRecord, Long> {
edition: Edition,
difficulty: Difficulty
): MutableList<PlayerPvRecord>
fun findByPvIdAndEditionAndDifficultyOrderByMaxScoreDesc(
pvId: Int,
edition: Edition,
difficulty: Difficulty,
page: Pageable
): Page<PlayerPvRecord>
fun findByPdId_PdIdOrderByPvId(pdId: Long, page: Pageable): Page<PlayerPvRecord>
fun findByPdId_PdIdAndPvId(pdId: Long, pvId: Int): MutableList<PlayerPvRecord>
}
interface PlayerScreenShotRepository : JpaRepository<PlayerScreenShot, Long> {
fun findByPdId_PdId(pdId: Long): MutableList<PlayerScreenShot>
fun findByFileName(fileName: String): Optional<PlayerScreenShot>
}
interface PlayerScreenShotRepository : JpaRepository<PlayerScreenShot, Long>
@Repository
interface PlayLogRepository : JpaRepository<PlayLog, Long> {
fun findByPdId_PdIdOrderByDateTimeDesc(pdId: Long, page: Pageable): Page<PlayLog>
}
interface PlayLogRepository : JpaRepository<PlayLog, Long>
@Repository
interface PlayerModuleRepository : JpaRepository<PlayerModule, Long> {
fun findByPdId(profile: PlayerProfile): MutableList<PlayerModule>
fun findByPdId_PdId(pdId: Long, pageable: Pageable): Page<PlayerModule>
}

View File

@ -36,9 +36,6 @@ class AttendHandler {
)
}
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component
class PingHandler(val rp: PropertyEntryRepository) {
fun handle(request: BaseRequest): Any {

View File

@ -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(",")

View File

@ -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<ProfileNotFoundException>(
Supplier { ProfileNotFoundException() })
@ -41,8 +33,8 @@ class StartHandler(
session.startMode = StartMode.START
db.gameSession.save<GameSession>(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,

View File

@ -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;
}

View File

@ -40,3 +40,5 @@ drop table chuni_user_data;
drop table sega_game_version;
drop table diva_ng_words;