forked from Cookies_Github_mirror/AquaDX
[api] Add rest of the player data to api
This commit is contained in:
@@ -16,9 +16,12 @@ import java.util.Optional;
|
||||
@Repository
|
||||
public interface UserCharacterRepository extends JpaRepository<UserCharacter, Long> {
|
||||
|
||||
Optional<UserCharacter> findTopByUserAndCharacterIdOrderByIdDesc(UserData user, int characterId);
|
||||
|
||||
Page<UserCharacter> findByUser_Card_ExtId(int extId, Pageable pageable);
|
||||
|
||||
List<UserCharacter> findByUser_Card_ExtId(int extId);
|
||||
|
||||
Optional<UserCharacter> findTopByUserAndCharacterIdOrderByIdDesc(UserData user, int characterId);
|
||||
|
||||
Optional<UserCharacter> findByUser_Card_ExtIdAndCharacterId(int extId, int characterId);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package icu.samnyan.aqua.sega.chunithm.dao.userdata;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserData;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.userdata.UserItem;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -21,4 +22,6 @@ public interface UserItemRepository extends JpaRepository<UserItem, Long> {
|
||||
Page<UserItem> findAllByUser_Card_ExtIdAndItemKind(int extId, int itemKind, Pageable pageable);
|
||||
|
||||
List<UserItem> findAllByUser_Card_ExtId(int extId);
|
||||
|
||||
Page<UserItem> findByUser_Card_ExtId(int extId, Pageable pageable);
|
||||
}
|
||||
|
||||
@@ -36,23 +36,23 @@ public class UserCharacter implements Serializable {
|
||||
@Column(name = "character_id")
|
||||
private int characterId;
|
||||
|
||||
private int playCount;
|
||||
private int playCount = 0;
|
||||
|
||||
private int level;
|
||||
private int level = 1;
|
||||
|
||||
private int skillId;
|
||||
private int skillId = 0;
|
||||
|
||||
private int friendshipExp;
|
||||
private int friendshipExp = 0;
|
||||
|
||||
@JsonProperty("isValid")
|
||||
private boolean isValid;
|
||||
private boolean isValid = true;
|
||||
|
||||
@JsonProperty("isNewMark")
|
||||
private boolean isNewMark;
|
||||
private boolean isNewMark = true;
|
||||
|
||||
private int param1;
|
||||
private int param1 = 0;
|
||||
|
||||
private int param2;
|
||||
private int param2 = 0;
|
||||
|
||||
public UserCharacter(UserData userData) {
|
||||
user = userData;
|
||||
|
||||
@@ -40,10 +40,10 @@ public class UserItem implements Serializable {
|
||||
@Column(name = "item_id")
|
||||
private int itemId;
|
||||
|
||||
private int stock;
|
||||
private int stock = 1;
|
||||
|
||||
@JsonProperty("isValid")
|
||||
private boolean isValid;
|
||||
private boolean isValid = true;
|
||||
|
||||
public UserItem(UserData userData) {
|
||||
user = userData;
|
||||
|
||||
@@ -45,4 +45,5 @@ public class UserCharacterService {
|
||||
public Optional<UserCharacter> getByUserAndCharacterId(UserData user, int characterId) {
|
||||
return userCharacterRepository.findTopByUserAndCharacterIdOrderByIdDesc(user, characterId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,4 +44,8 @@ public class UserItemService {
|
||||
Pageable page = PageRequest.of(pageNumber, maxCount);
|
||||
return userItemRepository.findAllByUser_Card_ExtIdAndItemKind(Integer.parseInt(userId), kind, page);
|
||||
}
|
||||
|
||||
public Page<UserItem> getByUserId(String userId, int page, int size) {
|
||||
return userItemRepository.findByUser_Card_ExtId(Integer.parseInt(userId), PageRequest.of(page, size));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user