forked from Cookies_Github_mirror/AquaDX
[O] Redesign wacca score model
This commit is contained in:
@@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||
import icu.samnyan.aqua.net.games.BaseEntity
|
||||
import icu.samnyan.aqua.net.games.IGenericUserData
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.maimai2.util.IntegerListConverter
|
||||
import icu.samnyan.aqua.sega.general.IntegerListConverter
|
||||
import icu.samnyan.aqua.sega.util.jackson.AccessCodeSerializer
|
||||
import jakarta.persistence.*
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder
|
||||
import icu.samnyan.aqua.net.games.BaseEntity
|
||||
import icu.samnyan.aqua.net.games.IGenericGamePlaylog
|
||||
import icu.samnyan.aqua.sega.maimai2.util.IntegerListConverter
|
||||
import icu.samnyan.aqua.sega.general.IntegerListConverter
|
||||
import jakarta.persistence.*
|
||||
import lombok.AllArgsConstructor
|
||||
import lombok.Data
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
import static java.util.Collections.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Converter
|
||||
public class IntegerListConverter implements AttributeConverter<List<Integer>, String> {
|
||||
private static final String SPLIT_CHAR = ";";
|
||||
|
||||
@Override
|
||||
public String convertToDatabaseColumn(List<Integer> integerList) {
|
||||
if (integerList != null && !integerList.isEmpty()) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
Iterator<Integer> iter = integerList.iterator();
|
||||
while(iter.hasNext()) {
|
||||
str.append(iter.next());
|
||||
if(iter.hasNext()){
|
||||
str.append(SPLIT_CHAR);
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> convertToEntityAttribute(String string) {
|
||||
if (string != null && !string.isEmpty()) {
|
||||
List<Integer> iList = new ArrayList<>();
|
||||
for (String s : string.split(SPLIT_CHAR)) {
|
||||
iList.add(Integer.parseInt(s));
|
||||
}
|
||||
return iList;
|
||||
} else {
|
||||
return emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user