1.增加删除前监听事件 2.修改关键字key为id
This commit is contained in:
@@ -33,11 +33,11 @@ interface ICommandApp<TCommand : ICommand, TKey> : IApplication {
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/{key:.+}")
|
||||
fun remove(@PathVariable key: TKey): HttpMessage {
|
||||
return this.safeExecute("删除${this.name}失败[Key: $key]") {
|
||||
@DeleteMapping("/{id:.+}")
|
||||
fun remove(@PathVariable id: TKey): HttpMessage {
|
||||
return this.safeExecute("删除${this.name}失败[id: $id]") {
|
||||
if (this.service != null)
|
||||
it.data = this.service!!.remove(key)
|
||||
it.data = this.service!!.remove(id)
|
||||
else {
|
||||
it.status = Status.Error
|
||||
it.message = "没有对应服务,无法执行该操作"
|
||||
@@ -45,11 +45,11 @@ interface ICommandApp<TCommand : ICommand, TKey> : IApplication {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/{key:.+}")
|
||||
fun update(@PathVariable key: TKey, @RequestBody command: TCommand): HttpMessage {
|
||||
@PutMapping("/{id:.+}")
|
||||
fun update(@PathVariable id: TKey, @RequestBody command: TCommand): HttpMessage {
|
||||
return this.safeExecute("更新${this.name}失败 - ${if (jsonSerializer != null) jsonSerializer?.serialize(command) else ""}") {
|
||||
if (this.service != null)
|
||||
this.service!!.update(key, command)
|
||||
this.service!!.update(id, command)
|
||||
else {
|
||||
it.status = Status.Error
|
||||
it.message = "没有对应服务,无法执行该操作"
|
||||
|
||||
@@ -20,10 +20,10 @@ interface IQueryApp<TView, TKey> : IApplication {
|
||||
*/
|
||||
var clazz: Class<TView>
|
||||
|
||||
@GetMapping("/{key:.+}")
|
||||
fun get(@PathVariable key: TKey): HttpMessage {
|
||||
@GetMapping("/{id:.+}")
|
||||
fun get(@PathVariable id: TKey): HttpMessage {
|
||||
return this.doQuery("获取${this.name}数据失败") {
|
||||
this.query!!.get(key, clazz)
|
||||
this.query!!.get(id, clazz)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ interface ISpecificQueryApp<TView, TKey> : IApplication {
|
||||
*/
|
||||
var query: ISpecificQuery<TView, TKey>?
|
||||
|
||||
@GetMapping("/{key:.+}")
|
||||
fun get(@PathVariable key: TKey): HttpMessage {
|
||||
@GetMapping("/{id:.+}")
|
||||
fun get(@PathVariable id: TKey): HttpMessage {
|
||||
return this.doQuery("获取${this.name}数据失败") {
|
||||
this.query!!.get(key)
|
||||
this.query!!.get(id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user