[O] Refactor maimai2 repositories

This commit is contained in:
Azalea
2024-03-16 19:50:05 -04:00
parent e07de72fa4
commit 54b1174e1b
32 changed files with 231 additions and 552 deletions

View File

@@ -11,7 +11,7 @@ import java.util.Optional;
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("ChusanUserDataRepository")
public interface UserDataRepository extends GenericUserDataRepo<UserData, Long> {
public interface UserDataRepository extends GenericUserDataRepo<UserData> {
Optional<UserData> findByCard_ExtId(Long extId);
}

View File

@@ -4,7 +4,6 @@ import icu.samnyan.aqua.net.games.GenericPlaylogRepo;
import icu.samnyan.aqua.sega.chusan.model.userdata.UserPlaylog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -13,12 +12,10 @@ import java.util.List;
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("ChusanUserPlaylogRepository")
public interface UserPlaylogRepository extends JpaRepository<UserPlaylog, Long>, GenericPlaylogRepo {
public interface UserPlaylogRepository extends GenericPlaylogRepo<UserPlaylog> {
List<UserPlaylog> findByUser_Card_ExtIdAndLevelNot(Long extId, int levelNot, Pageable page);
Page<UserPlaylog> findByUser_Card_ExtId(Long extId, Pageable page);
Page<UserPlaylog> findByUserCardExtId(Long extId, Pageable page);
List<UserPlaylog> findByUser_Card_ExtIdAndMusicIdAndLevel(Long extId, int musicId, int level);
List<UserPlaylog> findByUser_Card_ExtId(Long extId);
}

View File

@@ -33,7 +33,7 @@ public class UserPlaylogService {
}
public Page<UserPlaylog> getRecentPlays(String userId, Pageable page) {
return userPlaylogRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
return userPlaylogRepository.findByUserCardExtId(Long.parseLong(userId), page);
}
public List<UserPlaylog> getRecent30Plays(String userId) {
@@ -42,7 +42,7 @@ public class UserPlaylogService {
}
public List<UserPlaylog> getByUserId(String userId) {
return userPlaylogRepository.findByUser_Card_ExtId(Long.parseLong(userId));
return userPlaylogRepository.findByUserCardExtId(Long.parseLong(userId));
}
public List<UserPlaylog> getByUserIdAndMusicIdAndLevel(String userId, int id, int level) {