1.增加删除前监听事件 2.修改关键字key为id

This commit is contained in:
2020-10-27 16:46:32 +08:00
parent 21434d8cd3
commit d1c843cbae
10 changed files with 110 additions and 39 deletions

View File

@@ -57,8 +57,8 @@ open class MongoQuery(var template: MongoTemplate, var logger: ILogger? = null)
return result
}
override fun <TView, TKey> get(key: TKey, clazz: Class<TView>): TView? {
return this.template.findOne(whereId(key), clazz, this.collection(clazz))
override fun <TView, TKey> get(id: TKey, clazz: Class<TView>): TView? {
return this.template.findOne(whereId(id), clazz, this.collection(clazz))
}
/**

View File

@@ -110,10 +110,10 @@ open class MongoSpecificQuery<TView>(
} else Page(1, 10)
}
override fun get(key: String): TView? {
override fun get(id: String): TView? {
this.check()
return if (this.clazz != null) {
val view = this.template.findOne(whereId(key), this.clazz!!, this.collection)
val view = this.template.findOne(whereId(id), this.clazz!!, this.collection)
view
} else null
}