mirror of
https://github.com/correl/mage.git
synced 2025-03-31 01:07:39 -09:00
DB: added numerical card number field for min/max query (#8383);
This commit is contained in:
parent
23bcc9dbb5
commit
a480e10bd8
2 changed files with 10 additions and 3 deletions
Mage/src/main/java/mage/cards/repository
|
@ -40,6 +40,7 @@ public class CardCriteria {
|
|||
private String sortBy;
|
||||
private Long start;
|
||||
private Long count;
|
||||
// compare numerical card numbers (123b -> 123)
|
||||
private int minCardNumber;
|
||||
private int maxCardNumber;
|
||||
|
||||
|
@ -304,12 +305,12 @@ public class CardCriteria {
|
|||
}
|
||||
|
||||
if (minCardNumber != Integer.MIN_VALUE) {
|
||||
where.ge("cardNumber", minCardNumber);
|
||||
where.ge("cardNumberAsInt", minCardNumber);
|
||||
clausesCount++;
|
||||
}
|
||||
|
||||
if (maxCardNumber != Integer.MAX_VALUE) {
|
||||
where.le("cardNumber", maxCardNumber);
|
||||
where.le("cardNumberAsInt", maxCardNumber);
|
||||
clausesCount++;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,11 @@ public class CardInfo {
|
|||
protected String setCode;
|
||||
@DatabaseField(indexName = "setCode_cardNumber_index")
|
||||
protected String cardNumber;
|
||||
/**
|
||||
* Fast access to numerical card number (number without prefix/postfix: 123b -> 123)
|
||||
*/
|
||||
@DatabaseField(indexName = "cardNumberAsInt_index")
|
||||
protected int cardNumberAsInt;
|
||||
@DatabaseField(indexName = "className_index")
|
||||
protected String className;
|
||||
@DatabaseField
|
||||
|
@ -124,6 +129,7 @@ public class CardInfo {
|
|||
this.name = card.getName();
|
||||
this.lower_name = name.toLowerCase(Locale.ENGLISH);
|
||||
this.cardNumber = card.getCardNumber();
|
||||
this.cardNumberAsInt = CardUtil.parseCardNumberAsInt(card.getCardNumber());
|
||||
this.setCode = card.getExpansionSetCode();
|
||||
this.className = card.getClass().getCanonicalName();
|
||||
this.power = card.getPower().toString();
|
||||
|
@ -424,7 +430,7 @@ public class CardInfo {
|
|||
}
|
||||
|
||||
public int getCardNumberAsInt() {
|
||||
return CardUtil.parseCardNumberAsInt(cardNumber);
|
||||
return cardNumberAsInt;
|
||||
}
|
||||
|
||||
public boolean isSplitCard() {
|
||||
|
|
Loading…
Add table
Reference in a new issue