diff --git a/build.gradle b/build.gradle index 41816a9..1a019b2 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ allprojects { subprojects { ext { - version '0.10.2' + version '0.10.3' spring_version = "2.3.0.RELEASE" } diff --git a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/ICommandApp.kt b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/ICommandApp.kt index 5ad87eb..4a4bf4b 100644 --- a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/ICommandApp.kt +++ b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/ICommandApp.kt @@ -54,7 +54,12 @@ interface ICommandApp : IApplication { fun remove(@PathVariable id: TKey): HttpMessage { val msg = HttpMessage() if (this.service != null) - msg.data = this.service!!.remove(id) + try { + msg.data = this.service!!.remove(id) + } catch (ex: IllegalStateException) { + msg.status = Status.Error + msg.message = ex.message ?: "" + } else { msg.status = Status.Error msg.message = "没有对应服务,无法执行该操作" diff --git a/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt b/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt index 4980f82..1c1349f 100644 --- a/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt +++ b/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt @@ -42,8 +42,12 @@ fun Query.where( //日期类型特殊处理为String类型 val fieldType = onFieldType(key) - if (fieldType != null && value.javaClass != fieldType && fieldType == Date::class.java) { - value = DateTime(value.toString(), "yyyy-MM-dd HH:mm:ss").date + if (fieldType != null && value.javaClass != fieldType) { + when (fieldType) { + Date::class.java -> value = DateTime(value.toString(), "yyyy-MM-ddTHH:mm:ss").date + Int::class.java -> value = value.toString().toInt() + Integer::class.java -> value = value.toString().toInt() + } } val where = onWhere(key) diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Service.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Service.kt index 5b4600b..c68a1f1 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Service.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Service.kt @@ -69,7 +69,7 @@ open class Service, TKey>( for (func in functions) { msg = func(id) if (!msg.success()) { - throw RuntimeException(msg.message) + throw IllegalStateException(msg.message) } } this.repository.remove(id, this.clazz)