From f795dc145fc346feaea39e4747ea03b07bbac806 Mon Sep 17 00:00:00 2001 From: xihan123 Date: Mon, 28 Aug 2023 15:41:23 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=96=B0=E5=A2=9E=E6=88=96=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E9=80=89=E9=A1=B9=E6=97=B6=E6=A0=B9=E6=8D=AE=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E9=87=8D=E6=96=B0=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xihan123 --- app/src/main/kotlin/cn/xihan/qdds/Utils.kt | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/cn/xihan/qdds/Utils.kt b/app/src/main/kotlin/cn/xihan/qdds/Utils.kt index a5324f9..892ceeb 100644 --- a/app/src/main/kotlin/cn/xihan/qdds/Utils.kt +++ b/app/src/main/kotlin/cn/xihan/qdds/Utils.kt @@ -642,17 +642,17 @@ fun MutableList.updateSelectedListOptionEntity(newCo plusAssign(newConfig) } } - return this + return this.sortedBy { it.title }.toMutableList() } /** * 删除列表选项标题 */ -fun MutableList.deleteSelectedOption(newConfigurations: List): MutableList { +fun MutableList.deleteSelectedOption(newConfigurations: List): List { this.removeAll { it.title !in newConfigurations.map { newConfigurationItem -> newConfigurationItem.title } } - return this + return this.sortedBy { it.title } } /** @@ -665,7 +665,7 @@ fun MutableList.updateStringListOptionEntity(newConfigurations: List this.toJSONString() is Parcelable -> this.toJSONString() else -> { - if (this?.javaClass?.name?.contains("Entity") == true || this?.javaClass?.name?.contains("Model") == true || this?.javaClass?.name?.contains( - "Bean" - ) == true || this?.javaClass?.name?.contains("Result") == true - ) this.toJSONString() - else if (this?.javaClass?.name?.contains("QDHttpResp") == true) { + val list = listOf( + "Entity", + "Model", + "Bean", + "Result", + ) + + if (list.any { this?.javaClass?.name?.contains(it) == true }) + this.toJSONString() + else if (this?.javaClass?.name?.contains("QDHttpResp") == true) this.getParamList().toString() - } else { + else this?.toString() ?: "null" - } + } }