[M] riik CMission repos

This commit is contained in:
Azalea
2024-12-26 06:38:45 -05:00
parent f0923c51e6
commit da467ec8ee
3 changed files with 211 additions and 222 deletions

View File

@@ -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<UserCMissionProgress, Long> {
List<UserCMissionProgress> findByUser_Card_ExtIdAndMissionId(Long extId, int missionId);
Optional<UserCMissionProgress> findByUser_Card_ExtIdAndMissionIdAndOrder(Long extId, int missionId, int order);
}

View File

@@ -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<UserCMission, Long> {
Optional<UserCMission> findByUser_Card_ExtIdAndMissionId(Long extId, int missionId);
}

View File

@@ -1,196 +1,212 @@
@file:Suppress("FunctionName") @file:Suppress("FunctionName")
package icu.samnyan.aqua.sega.chusan.model package icu.samnyan.aqua.sega.chusan.model
import icu.samnyan.aqua.net.games.GenericPlaylogRepo import icu.samnyan.aqua.net.games.GenericPlaylogRepo
import icu.samnyan.aqua.net.games.GenericUserDataRepo import icu.samnyan.aqua.net.games.GenericUserDataRepo
import icu.samnyan.aqua.net.games.IUserRepo import icu.samnyan.aqua.net.games.IUserRepo
import icu.samnyan.aqua.sega.chusan.model.gamedata.* import icu.samnyan.aqua.sega.chusan.model.gamedata.*
import icu.samnyan.aqua.sega.chusan.model.userdata.* import icu.samnyan.aqua.sega.chusan.model.userdata.*
import org.springframework.data.domain.Page import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.NoRepositoryBean import org.springframework.data.repository.NoRepositoryBean
import org.springframework.stereotype.Component import org.springframework.stereotype.Component
import java.util.* import java.util.*
@NoRepositoryBean @NoRepositoryBean
interface Chu3UserLinked<T> : IUserRepo<Chu3UserData, T> { interface Chu3UserLinked<T> : IUserRepo<Chu3UserData, T> {
fun findByUser_Card_ExtId(extId: Long): List<T> fun findByUser_Card_ExtId(extId: Long): List<T>
fun findSingleByUser_Card_ExtId(extId: Long): Optional<T> fun findSingleByUser_Card_ExtId(extId: Long): Optional<T>
fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T> fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T>
} }
// This repo cannot be generalized as UserLinked because the entity stores user as an int // This repo cannot be generalized as UserLinked because the entity stores user as an int
// TODO: Find a way to generalize this // TODO: Find a way to generalize this
interface Chu3UserLoginBonusRepo : JpaRepository<UserLoginBonus, Long> { interface Chu3UserLoginBonusRepo : JpaRepository<UserLoginBonus, Long> {
@Query( @Query(
value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and is_finished = ?3 order by last_update_date desc", 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 nativeQuery = true
) )
fun findAllLoginBonus(userId: Int, version: Int, isFinished: Int): List<UserLoginBonus> fun findAllLoginBonus(userId: Int, version: Int, isFinished: Int): List<UserLoginBonus>
@Query( @Query(
value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and preset_id = ?3 limit 1", value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and preset_id = ?3 limit 1",
nativeQuery = true nativeQuery = true
) )
fun findLoginBonus(userId: Int, version: Int, presetId: Int): Optional<UserLoginBonus> fun findLoginBonus(userId: Int, version: Int, presetId: Int): Optional<UserLoginBonus>
} }
interface Chu3UserActivityRepo : Chu3UserLinked<UserActivity> { interface Chu3UserActivityRepo : Chu3UserLinked<UserActivity> {
fun findTopByUserAndActivityIdAndKindOrderByIdDesc(user: Chu3UserData, activityId: Int, kind: Int): Optional<UserActivity> fun findTopByUserAndActivityIdAndKindOrderByIdDesc(user: Chu3UserData, activityId: Int, kind: Int): Optional<UserActivity>
fun findByUserAndActivityIdAndKind(user: Chu3UserData, activityId: Int, kind: Int): UserActivity?
fun findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(extId: Long, kind: Int): List<UserActivity>
fun findAllByUser_Card_ExtIdAndKind(extId: Long, kind: Int): List<UserActivity> fun findAllByUser_Card_ExtIdAndKind(extId: Long, kind: Int): List<UserActivity>
} }
interface Chu3UserCardPrintStateRepo : Chu3UserLinked<UserCardPrintState> { interface Chu3UserCardPrintStateRepo : Chu3UserLinked<UserCardPrintState> {
fun findByUser_Card_ExtIdAndHasCompleted(extId: Long, hasCompleted: Boolean): List<UserCardPrintState> fun findByUser_Card_ExtIdAndHasCompleted(extId: Long, hasCompleted: Boolean): List<UserCardPrintState>
fun findByUserAndGachaIdAndHasCompleted(userData: Chu3UserData, gachaId: Int, hasCompleted: Boolean): List<UserCardPrintState> fun findByUserAndGachaIdAndHasCompleted(userData: Chu3UserData, gachaId: Int, hasCompleted: Boolean): List<UserCardPrintState>
} }
interface Chu3UserCharacterRepo : Chu3UserLinked<UserCharacter> { interface Chu3UserCharacterRepo : Chu3UserLinked<UserCharacter> {
fun findTopByUserAndCharacterIdOrderByIdDesc(user: Chu3UserData, characterId: Int): Optional<UserCharacter> fun findTopByUserAndCharacterIdOrderByIdDesc(user: Chu3UserData, characterId: Int): Optional<UserCharacter>
} fun findByUserAndCharacterId(user: Chu3UserData, characterId: Int): UserCharacter?
}
interface Chu3UserChargeRepo : Chu3UserLinked<UserCharge> {
fun findByUserAndChargeId(extId: Chu3UserData, chargeId: Int): Optional<UserCharge> interface Chu3UserChargeRepo : Chu3UserLinked<UserCharge> {
} fun findByUserAndChargeId(extId: Chu3UserData, chargeId: Int): Optional<UserCharge>
}
interface Chu3UserCourseRepo : Chu3UserLinked<UserCourse> {
fun findTopByUserAndCourseIdOrderByIdDesc(user: Chu3UserData, courseId: Int): Optional<UserCourse> interface Chu3UserCourseRepo : Chu3UserLinked<UserCourse> {
} fun findTopByUserAndCourseIdOrderByIdDesc(user: Chu3UserData, courseId: Int): Optional<UserCourse>
fun findByUserAndCourseId(user: Chu3UserData, courseId: Int): UserCourse?
interface Chu3UserDataRepo : GenericUserDataRepo<Chu3UserData> }
interface Chu3UserDuelRepo : Chu3UserLinked<UserDuel> { interface Chu3UserDataRepo : GenericUserDataRepo<Chu3UserData>
fun findTopByUserAndDuelIdOrderByIdDesc(user: Chu3UserData, duelId: Int): Optional<UserDuel>
} interface Chu3UserDuelRepo : Chu3UserLinked<UserDuel> {
fun findTopByUserAndDuelIdOrderByIdDesc(user: Chu3UserData, duelId: Int): Optional<UserDuel>
interface Chu3UserGachaRepo : Chu3UserLinked<UserGacha> { fun findByUserAndDuelId(user: Chu3UserData, duelId: Int): UserDuel?
fun findByUserAndGachaId(extId: Chu3UserData, gachaId: Int): Optional<UserGacha> }
}
interface Chu3UserGachaRepo : Chu3UserLinked<UserGacha> {
interface Chu3UserGameOptionRepo : Chu3UserLinked<UserGameOption> fun findByUserAndGachaId(extId: Chu3UserData, gachaId: Int): Optional<UserGacha>
}
interface Chu3UserGeneralDataRepo : Chu3UserLinked<UserGeneralData> {
fun findByUserAndPropertyKey(user: Chu3UserData, key: String): Optional<UserGeneralData> interface Chu3UserGameOptionRepo : Chu3UserLinked<UserGameOption>
fun findByUser_Card_ExtIdAndPropertyKey(extId: Long, key: String): Optional<UserGeneralData> interface Chu3UserGeneralDataRepo : Chu3UserLinked<UserGeneralData> {
} fun findByUserAndPropertyKey(user: Chu3UserData, key: String): Optional<UserGeneralData>
interface Chu3UserItemRepo : Chu3UserLinked<UserItem> { fun findByUser_Card_ExtIdAndPropertyKey(extId: Long, key: String): Optional<UserGeneralData>
fun findTopByUserAndItemIdAndItemKindOrderByIdDesc(user: Chu3UserData, itemId: Int, itemKind: Int): Optional<UserItem> }
fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int, pageable: Pageable): Page<UserItem> interface Chu3UserItemRepo : Chu3UserLinked<UserItem> {
fun findTopByUserAndItemIdAndItemKindOrderByIdDesc(user: Chu3UserData, itemId: Int, itemKind: Int): Optional<UserItem>
fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int): List<UserItem> fun findByUserAndItemIdAndItemKind(user: Chu3UserData, itemId: Int, itemKind: Int): UserItem?
}
fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int, pageable: Pageable): Page<UserItem>
interface Chu3UserMapRepo : Chu3UserLinked<UserMap> {
fun findTopByUserAndMapAreaIdOrderByIdDesc(user: Chu3UserData, mapAreaId: Int): Optional<UserMap> fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int): List<UserItem>
}
@Query("SELECT uma FROM ChusanUserMapArea uma WHERE uma.user.card.extId = :extId AND uma.mapAreaId IN :mapAreaIds")
fun findAllUserMaps(extId: Long, mapAreaIds: List<Int>): List<UserMap> interface Chu3UserMapRepo : Chu3UserLinked<UserMap> {
} fun findByUserAndMapAreaId(user: Chu3UserData, mapAreaId: Int): UserMap?
interface Chu3UserMusicDetailRepo : Chu3UserLinked<UserMusicDetail> { fun findAllByUserCardExtIdAndMapAreaIdIn(user: Long, mapAreaIds: List<Int>): List<UserMap>
fun findTopByUserAndMusicIdAndLevelOrderByIdDesc(user: Chu3UserData, musicId: Int, level: Int): Optional<UserMusicDetail> }
fun findByUser_Card_ExtIdAndMusicId(extId: Long, musicId: Int): List<UserMusicDetail> interface Chu3UserMusicDetailRepo : Chu3UserLinked<UserMusicDetail> {
} fun findTopByUserAndMusicIdAndLevelOrderByIdDesc(user: Chu3UserData, musicId: Int, level: Int): Optional<UserMusicDetail>
fun findByUserAndMusicIdAndLevel(user: Chu3UserData, musicId: Int, level: Int): UserMusicDetail?
interface Chu3UserPlaylogRepo : GenericPlaylogRepo<UserPlaylog>, Chu3UserLinked<UserPlaylog> {
fun findByUser_Card_ExtIdAndLevelNot(extId: Long, levelNot: Int, page: Pageable): List<UserPlaylog> fun findByUser_Card_ExtIdAndMusicId(extId: Long, musicId: Int): List<UserMusicDetail>
}
fun findByUser_Card_ExtIdAndMusicIdAndLevel(extId: Long, musicId: Int, level: Int): List<UserPlaylog>
} interface Chu3UserPlaylogRepo : GenericPlaylogRepo<UserPlaylog>, Chu3UserLinked<UserPlaylog> {
fun findByUser_Card_ExtIdAndLevelNot(extId: Long, levelNot: Int, page: Pageable): List<UserPlaylog>
interface Chu3GameAvatarAccRepo : JpaRepository<AvatarAcc, Long>
fun findByUser_Card_ExtIdAndMusicIdAndLevel(extId: Long, musicId: Int, level: Int): List<UserPlaylog>
interface Chu3GameCharacterRepo : JpaRepository<Character, Long> }
interface Chu3GameChargeRepo : JpaRepository<GameCharge, Long> interface UserCMissionRepo : Chu3UserLinked<UserCMission> {
fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): Optional<UserCMission>
interface Chu3GameEventRepo : JpaRepository<GameEvent, Int> { }
fun findByEnable(enable: Boolean): List<GameEvent>
} interface UserCMissionProgressRepo : Chu3UserLinked<UserCMissionProgress> {
fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): List<UserCMissionProgress>
interface Chu3GameFrameRepo : JpaRepository<Frame, Long>
fun findByUser_Card_ExtIdAndMissionIdAndOrder(extId: Long, missionId: Int, order: Int): Optional<UserCMissionProgress>
interface Chu3GameGachaCardRepo : JpaRepository<GameGachaCard, Long> { }
fun findAllByGachaId(gachaId: Int): List<GameGachaCard>
} interface Chu3GameAvatarAccRepo : JpaRepository<AvatarAcc, Long>
interface Chu3GameGachaRepo : JpaRepository<GameGacha, Long> interface Chu3GameCharacterRepo : JpaRepository<Character, Long>
interface Chu3GameLoginBonusPresetsRepo : JpaRepository<GameLoginBonusPreset, Int> { interface Chu3GameChargeRepo : JpaRepository<GameCharge, Long>
@Query(
value = "select * from chusan_game_login_bonus_preset where version = ?1 and is_enabled = ?2", interface Chu3GameEventRepo : JpaRepository<GameEvent, Int> {
nativeQuery = true fun findByEnable(enable: Boolean): List<GameEvent>
) }
fun findLoginBonusPresets(version: Int, isEnabled: Int): List<GameLoginBonusPreset>
} interface Chu3GameFrameRepo : JpaRepository<Frame, Long>
interface Chu3GameLoginBonusRepo : JpaRepository<GameLoginBonus, Int> { interface Chu3GameGachaCardRepo : JpaRepository<GameGachaCard, Long> {
@Query( fun findAllByGachaId(gachaId: Int): List<GameGachaCard>
value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 order by need_login_day_count desc", }
nativeQuery = true
) interface Chu3GameGachaRepo : JpaRepository<GameGacha, Long>
fun findGameLoginBonus(version: Int, presetId: Int): List<GameLoginBonus>
interface Chu3GameLoginBonusPresetsRepo : JpaRepository<GameLoginBonusPreset, Int> {
@Query( @Query(
value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 and need_login_day_count = ?3 limit 1", value = "select * from chusan_game_login_bonus_preset where version = ?1 and is_enabled = ?2",
nativeQuery = true nativeQuery = true
) )
fun findByRequiredDays(version: Int, presetId: Int, requiredDays: Int): Optional<GameLoginBonus> fun findLoginBonusPresets(version: Int, isEnabled: Int): List<GameLoginBonusPreset>
} }
interface Chu3GameMapIconRepo : JpaRepository<MapIcon, Long> interface Chu3GameLoginBonusRepo : JpaRepository<GameLoginBonus, Int> {
@Query(
interface Chu3GameMusicRepo : JpaRepository<Music, Long> { value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 order by need_login_day_count desc",
fun findByMusicId(musicId: Int): Optional<Music> nativeQuery = true
} )
fun findGameLoginBonus(version: Int, presetId: Int): List<GameLoginBonus>
interface Chu3GameNamePlateRepo : JpaRepository<NamePlate, Long>
@Query(
interface Chu3GameSystemVoiceRepo : JpaRepository<SystemVoice, Long> value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 and need_login_day_count = ?3 limit 1",
nativeQuery = true
interface Chu3GameTrophyRepo : JpaRepository<Trophy, Long> )
fun findByRequiredDays(version: Int, presetId: Int, requiredDays: Int): Optional<GameLoginBonus>
@Component }
class Chu3Repos(
val userLoginBonus: Chu3UserLoginBonusRepo, interface Chu3GameMapIconRepo : JpaRepository<MapIcon, Long>
val userActivity: Chu3UserActivityRepo,
val userCardPrintState: Chu3UserCardPrintStateRepo, interface Chu3GameMusicRepo : JpaRepository<Music, Long> {
val userCharacter: Chu3UserCharacterRepo, fun findByMusicId(musicId: Int): Optional<Music>
val userCharge: Chu3UserChargeRepo, }
val userCourse: Chu3UserCourseRepo,
val userData: Chu3UserDataRepo, interface Chu3GameNamePlateRepo : JpaRepository<NamePlate, Long>
val userDuel: Chu3UserDuelRepo,
val userGacha: Chu3UserGachaRepo, interface Chu3GameSystemVoiceRepo : JpaRepository<SystemVoice, Long>
val userGameOption: Chu3UserGameOptionRepo,
val userGeneralData: Chu3UserGeneralDataRepo, interface Chu3GameTrophyRepo : JpaRepository<Trophy, Long>
val userItem: Chu3UserItemRepo,
val userMap: Chu3UserMapRepo, @Component
val userMusicDetail: Chu3UserMusicDetailRepo, class Chu3Repos(
val userPlaylog: Chu3UserPlaylogRepo, val userLoginBonus: Chu3UserLoginBonusRepo,
val gameAvatarAcc: Chu3GameAvatarAccRepo, val userActivity: Chu3UserActivityRepo,
val gameCharacter: Chu3GameCharacterRepo, val userCardPrintState: Chu3UserCardPrintStateRepo,
val gameCharge: Chu3GameChargeRepo, val userCharacter: Chu3UserCharacterRepo,
val gameEvent: Chu3GameEventRepo, val userCharge: Chu3UserChargeRepo,
val gameFrame: Chu3GameFrameRepo, val userCourse: Chu3UserCourseRepo,
val gameGachaCard: Chu3GameGachaCardRepo, val userData: Chu3UserDataRepo,
val gameGacha: Chu3GameGachaRepo, val userDuel: Chu3UserDuelRepo,
val gameLoginBonusPresets: Chu3GameLoginBonusPresetsRepo, val userGacha: Chu3UserGachaRepo,
val gameLoginBonus: Chu3GameLoginBonusRepo, val userGameOption: Chu3UserGameOptionRepo,
val gameMapIcon: Chu3GameMapIconRepo, val userGeneralData: Chu3UserGeneralDataRepo,
val gameMusic: Chu3GameMusicRepo, val userItem: Chu3UserItemRepo,
val gameNamePlate: Chu3GameNamePlateRepo, val userMap: Chu3UserMapRepo,
val gameSystemVoice: Chu3GameSystemVoiceRepo, val userMusicDetail: Chu3UserMusicDetailRepo,
val gameTrophy: Chu3GameTrophyRepo 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
) )