mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-09 17:37:27 +08:00
[F] Fix integer list converter behavior on empty lists
This commit is contained in:
@@ -6,5 +6,6 @@ import jakarta.persistence.Converter
|
|||||||
@Converter
|
@Converter
|
||||||
class IntegerListConverter : AttributeConverter<List<Int>, String> {
|
class IntegerListConverter : AttributeConverter<List<Int>, String> {
|
||||||
override fun convertToDatabaseColumn(lst: List<Int>?) = lst?.joinToString(";") ?: ""
|
override fun convertToDatabaseColumn(lst: List<Int>?) = lst?.joinToString(";") ?: ""
|
||||||
override fun convertToEntityAttribute(str: String?) = str?.split(';')?.map { it.toInt() }?.toMutableList() ?: mutableListOf()
|
override fun convertToEntityAttribute(str: String?) = if (str.isNullOrBlank()) mutableListOf() else
|
||||||
|
str.split(';').map { it.toInt() }.toMutableList()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user