mirror of https://github.com/hykilpikonna/AquaDX
[aimedb] Change extId type to integer
parent
95512aa843
commit
955e5727d5
|
@ -52,7 +52,11 @@ public class RegisterHandler implements BaseHandler {
|
|||
if(cardRepository.findByLuid((String) requestMap.get("luid")).isEmpty()) {
|
||||
Card card = new Card();
|
||||
card.setLuid((String) requestMap.get("luid"));
|
||||
card.setExtId(ThreadLocalRandom.current().nextLong(99999999));
|
||||
int extId = ThreadLocalRandom.current().nextInt(99999999);
|
||||
while (cardRepository.findByExtId(extId).isPresent()) {
|
||||
extId = ThreadLocalRandom.current().nextInt(99999999);
|
||||
}
|
||||
card.setExtId(extId);
|
||||
card.setRegisterTime(LocalDateTime.now());
|
||||
card.setAccessTime(LocalDateTime.now());
|
||||
|
||||
|
|
|
@ -16,5 +16,5 @@ public interface UserActivityRepository extends JpaRepository<UserActivity, Long
|
|||
|
||||
Optional<UserActivity> findTopByUserAndActivityIdAndKindOrderByIdDesc(UserData user, int activityId, int kind);
|
||||
|
||||
List<UserActivity> findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(long extId, int kind);
|
||||
List<UserActivity> findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(int extId, int kind);
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ public interface UserDataRepository extends JpaRepository<UserData, Long> {
|
|||
|
||||
Optional<UserData> findByCard(Card card);
|
||||
|
||||
Optional<UserData> findByCard_ExtId(long extId);
|
||||
Optional<UserData> findByCard_ExtId(int extId);
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ public interface UserDuelRepository extends JpaRepository<UserDuel, Long> {
|
|||
|
||||
Optional<UserDuel> findTopByUserAndDuelIdOrderByIdDesc(UserData user, int duelId);
|
||||
|
||||
List<UserDuel> findByUser_Card_ExtId(long extId);
|
||||
List<UserDuel> findByUser_Card_ExtId(int extId);
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ import java.util.Optional;
|
|||
public interface UserGameOptionExRepository extends JpaRepository<UserGameOptionEx, Long> {
|
||||
Optional<UserGameOptionEx> findByUser(UserData user);
|
||||
|
||||
Optional<UserGameOptionEx> findByUser_Card_ExtId(long parseLong);
|
||||
Optional<UserGameOptionEx> findByUser_Card_ExtId(int extId);
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ public interface UserGameOptionRepository extends JpaRepository<UserGameOption,
|
|||
|
||||
Optional<UserGameOption> findByUser(UserData user);
|
||||
|
||||
Optional<UserGameOption> findByUser_Card_ExtId(long extId);
|
||||
Optional<UserGameOption> findByUser_Card_ExtId(int extId);
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ public interface UserItemRepository extends JpaRepository<UserItem, Long> {
|
|||
|
||||
Optional<UserItem> findTopByUserAndItemIdAndItemKindOrderByIdDesc(UserData user, int itemId, int itemKind);
|
||||
|
||||
Page<UserItem> findAllByUser_Card_ExtIdAndItemKind(long extId, int itemKind, Pageable pageable);
|
||||
Page<UserItem> findAllByUser_Card_ExtIdAndItemKind(int extId, int itemKind, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Optional;
|
|||
public interface UserMapRepository extends JpaRepository<UserMap, Long> {
|
||||
List<UserMap> findAllByUser(UserData user);
|
||||
|
||||
List<UserMap> findAllByUser_Card_ExtId(long extId);
|
||||
List<UserMap> findAllByUser_Card_ExtId(int extId);
|
||||
|
||||
Optional<UserMap> findTopByUserAndMapIdOrderByIdDesc(UserData user, int mapId);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface UserMusicDetailRepository extends JpaRepository<UserMusicDetail
|
|||
|
||||
Optional<UserMusicDetail> findTopByUserAndMusicIdAndLevelOrderByIdDesc(UserData user, int musicId, int level);
|
||||
|
||||
List<UserMusicDetail> findByUser_Card_ExtId(long parseLong);
|
||||
List<UserMusicDetail> findByUser_Card_ExtId(int extId);
|
||||
|
||||
Page<UserMusicDetail> findByUser_Card_ExtId(long aimeId, Pageable page);
|
||||
Page<UserMusicDetail> findByUser_Card_ExtId(int extId, Pageable page);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
*/
|
||||
@Repository
|
||||
public interface UserPlaylogRepository extends JpaRepository<UserPlaylog, Long> {
|
||||
List<UserPlaylog> findByUser_Card_ExtIdAndLevelNot(long extId, int levelNot, Pageable page);
|
||||
List<UserPlaylog> findByUser_Card_ExtIdAndLevelNot(int extId, int levelNot, Pageable page);
|
||||
|
||||
List<UserPlaylog> findByUser_Card_ExtId(long parseLong, Pageable page);
|
||||
List<UserPlaylog> findByUser_Card_ExtId(int extId, Pageable page);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,6 @@ public class UserActivityService {
|
|||
}
|
||||
|
||||
public List<UserActivity> getAllByUserIdAndKind(String userId, String kind) {
|
||||
return userActivityRepository.findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(Long.parseLong(userId), Integer.parseInt(kind));
|
||||
return userActivityRepository.findAllByUser_Card_ExtIdAndKindOrderBySortNumberDesc(Integer.parseInt(userId), Integer.parseInt(kind));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,6 @@ public class UserCharacterService {
|
|||
|
||||
public Page<UserCharacter> getByUser(String userId, int pageNumber, int maxCount) {
|
||||
Pageable pageable = PageRequest.of(pageNumber, maxCount);
|
||||
return userCharacterRepository.findByUser_Card_ExtId(Long.parseLong(userId), pageable);
|
||||
return userCharacterRepository.findByUser_Card_ExtId(Integer.parseInt(userId), pageable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class UserChargeService {
|
|||
}
|
||||
|
||||
public List<UserCharge> getByUserId(String userId) {
|
||||
return userChargeRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userChargeRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Optional<UserCharge> getByUserAndChargeId(UserData user, String chargeId) {
|
||||
|
|
|
@ -38,11 +38,11 @@ public class UserCourseService {
|
|||
}
|
||||
|
||||
public List<UserCourse> getByUser(String userId) {
|
||||
return userCourseRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userCourseRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Page<UserCourse> getByUser(String userId, int pageNum, int maxCount) {
|
||||
Pageable page = PageRequest.of(pageNum, maxCount);
|
||||
return userCourseRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
|
||||
return userCourseRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@ public class UserDataExService {
|
|||
}
|
||||
|
||||
public Optional<UserDataEx> getUserByExtId(String userId) {
|
||||
return userDataExRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userDataExRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class UserDataService {
|
|||
}
|
||||
|
||||
public Optional<UserData> getUserByExtId(String aimeId) {
|
||||
return userDataRepository.findByCard_ExtId(Long.parseLong(aimeId));
|
||||
return userDataRepository.findByCard_ExtId(Integer.parseInt(aimeId));
|
||||
}
|
||||
|
||||
public String updateLoginTime(UserData userData) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class UserDuelService {
|
|||
}
|
||||
|
||||
public List<UserDuel> getByUser(String userId) {
|
||||
return userDuelRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userDuelRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@ public class UserGameOptionExService {
|
|||
}
|
||||
|
||||
public Optional<UserGameOptionEx> getByUserId(String userId) {
|
||||
return userGameOptionExRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userGameOptionExRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class UserGameOptionService {
|
|||
}
|
||||
|
||||
public Optional<UserGameOption> getByUserId(String userId) {
|
||||
return userGameOptionRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userGameOptionRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Optional<UserGameOption> getByUser(UserData user) {
|
||||
|
|
|
@ -39,6 +39,6 @@ public class UserItemService {
|
|||
|
||||
public Page<UserItem> getByUserAndItemKind(String userId, int kind, int pageNumber, int maxCount) {
|
||||
Pageable page = PageRequest.of(pageNumber, maxCount);
|
||||
return userItemRepository.findAllByUser_Card_ExtIdAndItemKind(Long.parseLong(userId), kind, page);
|
||||
return userItemRepository.findAllByUser_Card_ExtIdAndItemKind(Integer.parseInt(userId), kind, page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class UserMapService {
|
|||
}
|
||||
|
||||
public List<UserMap> getByUser(String userId) {
|
||||
return userMapRepository.findAllByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userMapRepository.findAllByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Optional<UserMap> getByUserAndMapId(UserData user, String mapId) {
|
||||
|
|
|
@ -38,11 +38,11 @@ public class UserMusicDetailService {
|
|||
}
|
||||
|
||||
public List<UserMusicDetail> getByUser(String userId) {
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Integer.parseInt(userId));
|
||||
}
|
||||
|
||||
public Page<UserMusicDetail> getByUser(String userId, int pageNum, int maxCount) {
|
||||
Pageable page = PageRequest.of(pageNum, maxCount);
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
|
||||
return userMusicDetailRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ public class UserPlaylogService {
|
|||
|
||||
public List<UserPlaylog> getRecent30Plays(String userId) {
|
||||
Pageable page = PageRequest.of(0, 30, Sort.by(Sort.Direction.DESC, "userPlayDate"));
|
||||
return userPlaylogRepository.findByUser_Card_ExtIdAndLevelNot(Long.parseLong(userId), 4, page);
|
||||
return userPlaylogRepository.findByUser_Card_ExtIdAndLevelNot(Integer.parseInt(userId), 4, page);
|
||||
}
|
||||
|
||||
public List<UserPlaylog> getRecentPlays(String userId) {
|
||||
Pageable page = PageRequest.of(0, 50, Sort.by(Sort.Direction.DESC, "userPlayDate"));
|
||||
return userPlaylogRepository.findByUser_Card_ExtId(Long.parseLong(userId), page);
|
||||
return userPlaylogRepository.findByUser_Card_ExtId(Integer.parseInt(userId), page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Optional;
|
|||
@Repository("SegaCardRepository")
|
||||
public interface CardRepository extends JpaRepository<Card, Long> {
|
||||
|
||||
Optional<Card> findByExtId(long extId);
|
||||
Optional<Card> findByExtId(int extId);
|
||||
|
||||
Optional<Card> findByLuid(String luid);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Card implements Serializable {
|
|||
|
||||
// A external id
|
||||
@Column(name = "ext_id", unique = true)
|
||||
private long extId;
|
||||
private Integer extId;
|
||||
|
||||
// Access Code
|
||||
@Column(unique = true)
|
||||
|
|
|
@ -21,6 +21,6 @@ public class CardService {
|
|||
}
|
||||
|
||||
public Optional<Card> getCardByExtId(String extId) {
|
||||
return cardRepository.findByExtId(Long.parseLong(extId));
|
||||
return cardRepository.findByExtId(Integer.parseInt(extId));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue