From da467ec8ee73453332f9581cbd1650d1c80965a9 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 26 Dec 2024 06:38:45 -0500 Subject: [PATCH] [M] riik CMission repos --- .../UserCMissionProgressRepository.java | 15 - .../dao/userdata/UserCMissionRepository.java | 12 - .../chusan/model/{Repos.kt => Chu3Repos.kt} | 406 +++++++++--------- 3 files changed, 211 insertions(+), 222 deletions(-) delete mode 100644 src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionProgressRepository.java delete mode 100644 src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionRepository.java rename src/main/java/icu/samnyan/aqua/sega/chusan/model/{Repos.kt => Chu3Repos.kt} (83%) diff --git a/src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionProgressRepository.java b/src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionProgressRepository.java deleted file mode 100644 index edfcdcfe..00000000 --- a/src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionProgressRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package icu.samnyan.aqua.sega.chusan.dao.userdata; - -import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMissionProgress; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; -import java.util.Optional; - -@Repository("ChusanUserCMissionProgressRepository") -public interface UserCMissionProgressRepository extends JpaRepository { - List findByUser_Card_ExtIdAndMissionId(Long extId, int missionId); - - Optional findByUser_Card_ExtIdAndMissionIdAndOrder(Long extId, int missionId, int order); -} \ No newline at end of file diff --git a/src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionRepository.java b/src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionRepository.java deleted file mode 100644 index 43cf446f..00000000 --- a/src/main/java/icu/samnyan/aqua/sega/chusan/dao/userdata/UserCMissionRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package icu.samnyan.aqua.sega.chusan.dao.userdata; - -import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMission; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import java.util.Optional; - -@Repository("ChusanUserCMissionRepository") -public interface UserCMissionRepository extends JpaRepository { - Optional findByUser_Card_ExtIdAndMissionId(Long extId, int missionId); -} diff --git a/src/main/java/icu/samnyan/aqua/sega/chusan/model/Repos.kt b/src/main/java/icu/samnyan/aqua/sega/chusan/model/Chu3Repos.kt similarity index 83% rename from src/main/java/icu/samnyan/aqua/sega/chusan/model/Repos.kt rename to src/main/java/icu/samnyan/aqua/sega/chusan/model/Chu3Repos.kt index 936b8dda..97688a50 100644 --- a/src/main/java/icu/samnyan/aqua/sega/chusan/model/Repos.kt +++ b/src/main/java/icu/samnyan/aqua/sega/chusan/model/Chu3Repos.kt @@ -1,196 +1,212 @@ -@file:Suppress("FunctionName") - -package icu.samnyan.aqua.sega.chusan.model - -import icu.samnyan.aqua.net.games.GenericPlaylogRepo -import icu.samnyan.aqua.net.games.GenericUserDataRepo -import icu.samnyan.aqua.net.games.IUserRepo -import icu.samnyan.aqua.sega.chusan.model.gamedata.* -import icu.samnyan.aqua.sega.chusan.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.NoRepositoryBean -import org.springframework.stereotype.Component -import java.util.* - - -@NoRepositoryBean -interface Chu3UserLinked : IUserRepo { - fun findByUser_Card_ExtId(extId: Long): List - fun findSingleByUser_Card_ExtId(extId: Long): Optional - fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page -} - - -// This repo cannot be generalized as UserLinked because the entity stores user as an int -// TODO: Find a way to generalize this -interface Chu3UserLoginBonusRepo : JpaRepository { - @Query( - value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and is_finished = ?3 order by last_update_date desc", - nativeQuery = true - ) - fun findAllLoginBonus(userId: Int, version: Int, isFinished: Int): List - - @Query( - value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and preset_id = ?3 limit 1", - nativeQuery = true - ) - fun findLoginBonus(userId: Int, version: Int, presetId: Int): Optional -} - -interface Chu3UserActivityRepo : Chu3UserLinked { - fun findTopByUserAndActivityIdAndKindOrderByIdDesc(user: Chu3UserData, activityId: Int, kind: Int): Optional - - fun findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(extId: Long, kind: Int): List - fun findAllByUser_Card_ExtIdAndKind(extId: Long, kind: Int): List -} - -interface Chu3UserCardPrintStateRepo : Chu3UserLinked { - fun findByUser_Card_ExtIdAndHasCompleted(extId: Long, hasCompleted: Boolean): List - - fun findByUserAndGachaIdAndHasCompleted(userData: Chu3UserData, gachaId: Int, hasCompleted: Boolean): List -} - -interface Chu3UserCharacterRepo : Chu3UserLinked { - fun findTopByUserAndCharacterIdOrderByIdDesc(user: Chu3UserData, characterId: Int): Optional -} - -interface Chu3UserChargeRepo : Chu3UserLinked { - fun findByUserAndChargeId(extId: Chu3UserData, chargeId: Int): Optional -} - -interface Chu3UserCourseRepo : Chu3UserLinked { - fun findTopByUserAndCourseIdOrderByIdDesc(user: Chu3UserData, courseId: Int): Optional -} - -interface Chu3UserDataRepo : GenericUserDataRepo - -interface Chu3UserDuelRepo : Chu3UserLinked { - fun findTopByUserAndDuelIdOrderByIdDesc(user: Chu3UserData, duelId: Int): Optional -} - -interface Chu3UserGachaRepo : Chu3UserLinked { - fun findByUserAndGachaId(extId: Chu3UserData, gachaId: Int): Optional -} - -interface Chu3UserGameOptionRepo : Chu3UserLinked - -interface Chu3UserGeneralDataRepo : Chu3UserLinked { - fun findByUserAndPropertyKey(user: Chu3UserData, key: String): Optional - - fun findByUser_Card_ExtIdAndPropertyKey(extId: Long, key: String): Optional -} - -interface Chu3UserItemRepo : Chu3UserLinked { - fun findTopByUserAndItemIdAndItemKindOrderByIdDesc(user: Chu3UserData, itemId: Int, itemKind: Int): Optional - - fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int, pageable: Pageable): Page - - fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int): List -} - -interface Chu3UserMapRepo : Chu3UserLinked { - fun findTopByUserAndMapAreaIdOrderByIdDesc(user: Chu3UserData, mapAreaId: Int): Optional - - @Query("SELECT uma FROM ChusanUserMapArea uma WHERE uma.user.card.extId = :extId AND uma.mapAreaId IN :mapAreaIds") - fun findAllUserMaps(extId: Long, mapAreaIds: List): List -} - -interface Chu3UserMusicDetailRepo : Chu3UserLinked { - fun findTopByUserAndMusicIdAndLevelOrderByIdDesc(user: Chu3UserData, musicId: Int, level: Int): Optional - - fun findByUser_Card_ExtIdAndMusicId(extId: Long, musicId: Int): List -} - -interface Chu3UserPlaylogRepo : GenericPlaylogRepo, Chu3UserLinked { - fun findByUser_Card_ExtIdAndLevelNot(extId: Long, levelNot: Int, page: Pageable): List - - fun findByUser_Card_ExtIdAndMusicIdAndLevel(extId: Long, musicId: Int, level: Int): List -} - -interface Chu3GameAvatarAccRepo : JpaRepository - -interface Chu3GameCharacterRepo : JpaRepository - -interface Chu3GameChargeRepo : JpaRepository - -interface Chu3GameEventRepo : JpaRepository { - fun findByEnable(enable: Boolean): List -} - -interface Chu3GameFrameRepo : JpaRepository - -interface Chu3GameGachaCardRepo : JpaRepository { - fun findAllByGachaId(gachaId: Int): List -} - -interface Chu3GameGachaRepo : JpaRepository - -interface Chu3GameLoginBonusPresetsRepo : JpaRepository { - @Query( - value = "select * from chusan_game_login_bonus_preset where version = ?1 and is_enabled = ?2", - nativeQuery = true - ) - fun findLoginBonusPresets(version: Int, isEnabled: Int): List -} - -interface Chu3GameLoginBonusRepo : JpaRepository { - @Query( - value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 order by need_login_day_count desc", - nativeQuery = true - ) - fun findGameLoginBonus(version: Int, presetId: Int): List - - @Query( - value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 and need_login_day_count = ?3 limit 1", - nativeQuery = true - ) - fun findByRequiredDays(version: Int, presetId: Int, requiredDays: Int): Optional -} - -interface Chu3GameMapIconRepo : JpaRepository - -interface Chu3GameMusicRepo : JpaRepository { - fun findByMusicId(musicId: Int): Optional -} - -interface Chu3GameNamePlateRepo : JpaRepository - -interface Chu3GameSystemVoiceRepo : JpaRepository - -interface Chu3GameTrophyRepo : JpaRepository - -@Component -class Chu3Repos( - val userLoginBonus: Chu3UserLoginBonusRepo, - val userActivity: Chu3UserActivityRepo, - val userCardPrintState: Chu3UserCardPrintStateRepo, - val userCharacter: Chu3UserCharacterRepo, - val userCharge: Chu3UserChargeRepo, - val userCourse: Chu3UserCourseRepo, - val userData: Chu3UserDataRepo, - val userDuel: Chu3UserDuelRepo, - val userGacha: Chu3UserGachaRepo, - val userGameOption: Chu3UserGameOptionRepo, - val userGeneralData: Chu3UserGeneralDataRepo, - val userItem: Chu3UserItemRepo, - val userMap: Chu3UserMapRepo, - val userMusicDetail: Chu3UserMusicDetailRepo, - val userPlaylog: Chu3UserPlaylogRepo, - val gameAvatarAcc: Chu3GameAvatarAccRepo, - val gameCharacter: Chu3GameCharacterRepo, - val gameCharge: Chu3GameChargeRepo, - val gameEvent: Chu3GameEventRepo, - val gameFrame: Chu3GameFrameRepo, - val gameGachaCard: Chu3GameGachaCardRepo, - val gameGacha: Chu3GameGachaRepo, - val gameLoginBonusPresets: Chu3GameLoginBonusPresetsRepo, - val gameLoginBonus: Chu3GameLoginBonusRepo, - val gameMapIcon: Chu3GameMapIconRepo, - val gameMusic: Chu3GameMusicRepo, - val gameNamePlate: Chu3GameNamePlateRepo, - val gameSystemVoice: Chu3GameSystemVoiceRepo, - val gameTrophy: Chu3GameTrophyRepo +@file:Suppress("FunctionName") + +package icu.samnyan.aqua.sega.chusan.model + +import icu.samnyan.aqua.net.games.GenericPlaylogRepo +import icu.samnyan.aqua.net.games.GenericUserDataRepo +import icu.samnyan.aqua.net.games.IUserRepo +import icu.samnyan.aqua.sega.chusan.model.gamedata.* +import icu.samnyan.aqua.sega.chusan.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.NoRepositoryBean +import org.springframework.stereotype.Component +import java.util.* + + +@NoRepositoryBean +interface Chu3UserLinked : IUserRepo { + fun findByUser_Card_ExtId(extId: Long): List + fun findSingleByUser_Card_ExtId(extId: Long): Optional + fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page +} + + +// This repo cannot be generalized as UserLinked because the entity stores user as an int +// TODO: Find a way to generalize this +interface Chu3UserLoginBonusRepo : JpaRepository { + @Query( + value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and is_finished = ?3 order by last_update_date desc", + nativeQuery = true + ) + fun findAllLoginBonus(userId: Int, version: Int, isFinished: Int): List + + @Query( + value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and preset_id = ?3 limit 1", + nativeQuery = true + ) + fun findLoginBonus(userId: Int, version: Int, presetId: Int): Optional +} + +interface Chu3UserActivityRepo : Chu3UserLinked { + fun findTopByUserAndActivityIdAndKindOrderByIdDesc(user: Chu3UserData, activityId: Int, kind: Int): Optional + fun findByUserAndActivityIdAndKind(user: Chu3UserData, activityId: Int, kind: Int): UserActivity? + + fun findAllByUser_Card_ExtIdAndKind(extId: Long, kind: Int): List +} + +interface Chu3UserCardPrintStateRepo : Chu3UserLinked { + fun findByUser_Card_ExtIdAndHasCompleted(extId: Long, hasCompleted: Boolean): List + + fun findByUserAndGachaIdAndHasCompleted(userData: Chu3UserData, gachaId: Int, hasCompleted: Boolean): List +} + +interface Chu3UserCharacterRepo : Chu3UserLinked { + fun findTopByUserAndCharacterIdOrderByIdDesc(user: Chu3UserData, characterId: Int): Optional + fun findByUserAndCharacterId(user: Chu3UserData, characterId: Int): UserCharacter? +} + +interface Chu3UserChargeRepo : Chu3UserLinked { + fun findByUserAndChargeId(extId: Chu3UserData, chargeId: Int): Optional +} + +interface Chu3UserCourseRepo : Chu3UserLinked { + fun findTopByUserAndCourseIdOrderByIdDesc(user: Chu3UserData, courseId: Int): Optional + fun findByUserAndCourseId(user: Chu3UserData, courseId: Int): UserCourse? +} + +interface Chu3UserDataRepo : GenericUserDataRepo + +interface Chu3UserDuelRepo : Chu3UserLinked { + fun findTopByUserAndDuelIdOrderByIdDesc(user: Chu3UserData, duelId: Int): Optional + fun findByUserAndDuelId(user: Chu3UserData, duelId: Int): UserDuel? +} + +interface Chu3UserGachaRepo : Chu3UserLinked { + fun findByUserAndGachaId(extId: Chu3UserData, gachaId: Int): Optional +} + +interface Chu3UserGameOptionRepo : Chu3UserLinked + +interface Chu3UserGeneralDataRepo : Chu3UserLinked { + fun findByUserAndPropertyKey(user: Chu3UserData, key: String): Optional + + fun findByUser_Card_ExtIdAndPropertyKey(extId: Long, key: String): Optional +} + +interface Chu3UserItemRepo : Chu3UserLinked { + fun findTopByUserAndItemIdAndItemKindOrderByIdDesc(user: Chu3UserData, itemId: Int, itemKind: Int): Optional + fun findByUserAndItemIdAndItemKind(user: Chu3UserData, itemId: Int, itemKind: Int): UserItem? + + fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int, pageable: Pageable): Page + + fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int): List +} + +interface Chu3UserMapRepo : Chu3UserLinked { + fun findByUserAndMapAreaId(user: Chu3UserData, mapAreaId: Int): UserMap? + + fun findAllByUserCardExtIdAndMapAreaIdIn(user: Long, mapAreaIds: List): List +} + +interface Chu3UserMusicDetailRepo : Chu3UserLinked { + fun findTopByUserAndMusicIdAndLevelOrderByIdDesc(user: Chu3UserData, musicId: Int, level: Int): Optional + fun findByUserAndMusicIdAndLevel(user: Chu3UserData, musicId: Int, level: Int): UserMusicDetail? + + fun findByUser_Card_ExtIdAndMusicId(extId: Long, musicId: Int): List +} + +interface Chu3UserPlaylogRepo : GenericPlaylogRepo, Chu3UserLinked { + fun findByUser_Card_ExtIdAndLevelNot(extId: Long, levelNot: Int, page: Pageable): List + + fun findByUser_Card_ExtIdAndMusicIdAndLevel(extId: Long, musicId: Int, level: Int): List +} + +interface UserCMissionRepo : Chu3UserLinked { + fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): Optional +} + +interface UserCMissionProgressRepo : Chu3UserLinked { + fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): List + + fun findByUser_Card_ExtIdAndMissionIdAndOrder(extId: Long, missionId: Int, order: Int): Optional +} + +interface Chu3GameAvatarAccRepo : JpaRepository + +interface Chu3GameCharacterRepo : JpaRepository + +interface Chu3GameChargeRepo : JpaRepository + +interface Chu3GameEventRepo : JpaRepository { + fun findByEnable(enable: Boolean): List +} + +interface Chu3GameFrameRepo : JpaRepository + +interface Chu3GameGachaCardRepo : JpaRepository { + fun findAllByGachaId(gachaId: Int): List +} + +interface Chu3GameGachaRepo : JpaRepository + +interface Chu3GameLoginBonusPresetsRepo : JpaRepository { + @Query( + value = "select * from chusan_game_login_bonus_preset where version = ?1 and is_enabled = ?2", + nativeQuery = true + ) + fun findLoginBonusPresets(version: Int, isEnabled: Int): List +} + +interface Chu3GameLoginBonusRepo : JpaRepository { + @Query( + value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 order by need_login_day_count desc", + nativeQuery = true + ) + fun findGameLoginBonus(version: Int, presetId: Int): List + + @Query( + value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 and need_login_day_count = ?3 limit 1", + nativeQuery = true + ) + fun findByRequiredDays(version: Int, presetId: Int, requiredDays: Int): Optional +} + +interface Chu3GameMapIconRepo : JpaRepository + +interface Chu3GameMusicRepo : JpaRepository { + fun findByMusicId(musicId: Int): Optional +} + +interface Chu3GameNamePlateRepo : JpaRepository + +interface Chu3GameSystemVoiceRepo : JpaRepository + +interface Chu3GameTrophyRepo : JpaRepository + +@Component +class Chu3Repos( + val userLoginBonus: Chu3UserLoginBonusRepo, + val userActivity: Chu3UserActivityRepo, + val userCardPrintState: Chu3UserCardPrintStateRepo, + val userCharacter: Chu3UserCharacterRepo, + val userCharge: Chu3UserChargeRepo, + val userCourse: Chu3UserCourseRepo, + val userData: Chu3UserDataRepo, + val userDuel: Chu3UserDuelRepo, + val userGacha: Chu3UserGachaRepo, + val userGameOption: Chu3UserGameOptionRepo, + val userGeneralData: Chu3UserGeneralDataRepo, + val userItem: Chu3UserItemRepo, + val userMap: Chu3UserMapRepo, + val userMusicDetail: Chu3UserMusicDetailRepo, + val userPlaylog: Chu3UserPlaylogRepo, + val userCMission: UserCMissionRepo, + val userCMissionProgress: UserCMissionProgressRepo, + val gameAvatarAcc: Chu3GameAvatarAccRepo, + val gameCharacter: Chu3GameCharacterRepo, + val gameCharge: Chu3GameChargeRepo, + val gameEvent: Chu3GameEventRepo, + val gameFrame: Chu3GameFrameRepo, + val gameGachaCard: Chu3GameGachaCardRepo, + val gameGacha: Chu3GameGachaRepo, + val gameLoginBonusPresets: Chu3GameLoginBonusPresetsRepo, + val gameLoginBonus: Chu3GameLoginBonusRepo, + val gameMapIcon: Chu3GameMapIconRepo, + val gameMusic: Chu3GameMusicRepo, + val gameNamePlate: Chu3GameNamePlateRepo, + val gameSystemVoice: Chu3GameSystemVoiceRepo, + val gameTrophy: Chu3GameTrophyRepo ) \ No newline at end of file