forked from Cookies_Github_mirror/AquaDX
[general] Fix all type mismatch with db
This commit is contained in:
@@ -12,7 +12,7 @@ import java.util.Optional;
|
||||
@Repository("SegaCardRepository")
|
||||
public interface CardRepository extends JpaRepository<Card, Long> {
|
||||
|
||||
Optional<Card> findByExtId(int extId);
|
||||
Optional<Card> findByExtId(Long 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 Integer extId;
|
||||
private Long extId;
|
||||
|
||||
// Access Code
|
||||
@Column(unique = true)
|
||||
|
||||
@@ -24,6 +24,7 @@ public class PropertyEntry implements Serializable {
|
||||
@Column(unique = true)
|
||||
private String propertyKey;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String propertyValue;
|
||||
|
||||
public PropertyEntry(String propertyKey, String propertyValue) {
|
||||
|
||||
@@ -28,15 +28,16 @@ public class CardService {
|
||||
* @return Optional of a Card
|
||||
*/
|
||||
public Optional<Card> getCardByExtId(String extId) {
|
||||
return cardRepository.findByExtId(Integer.parseInt(extId));
|
||||
return cardRepository.findByExtId(Long.parseLong(extId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a card by External Id
|
||||
*
|
||||
* @param extId External Id
|
||||
* @return Optional of a Card
|
||||
*/
|
||||
public Optional<Card> getCardByExtId(int extId) {
|
||||
public Optional<Card> getCardByExtId(Long extId) {
|
||||
return cardRepository.findByExtId(extId);
|
||||
}
|
||||
|
||||
@@ -57,9 +58,9 @@ public class CardService {
|
||||
public Card registerByAccessCode(String accessCode) {
|
||||
Card card = new Card();
|
||||
card.setLuid(accessCode);
|
||||
int extId = ThreadLocalRandom.current().nextInt(99999999);
|
||||
long extId = ThreadLocalRandom.current().nextLong(99999999);
|
||||
while (cardRepository.findByExtId(extId).isPresent()) {
|
||||
extId = ThreadLocalRandom.current().nextInt(99999999);
|
||||
extId = ThreadLocalRandom.current().nextLong(99999999);
|
||||
}
|
||||
card.setExtId(extId);
|
||||
card.setRegisterTime(LocalDateTime.now());
|
||||
|
||||
Reference in New Issue
Block a user