com.github.lsqlebai.curd.CURDController.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-common Show documentation
Show all versions of server-common Show documentation
An kotlin server common jar
package com.github.lsqlebai.curd
import org.springframework.beans.factory.InitializingBean
import org.springframework.web.bind.annotation.*
abstract class CURDController- : InitializingBean {
lateinit var curdService: CURDService
-
fun init(service: CURDService
- ) {
this.curdService = service
}
@GetMapping("/list/{id}")
fun listByParent(@PathVariable id: Int): List
- {
return curdService.listByParent(id)
}
@GetMapping("/{id}")
fun one(@PathVariable id: Int): Item? {
return curdService.one(id)
}
@DeleteMapping("/{id}")
fun delete(@PathVariable id: Int) {
return curdService.delete(id)
}
@GetMapping
fun listAll(): List
- {
return curdService.listAll()
}
@PutMapping
fun update(@RequestBody item: Item): Item? {
return curdService.update(item)
}
@PostMapping
fun create(@RequestBody item: Item): Item? {
return curdService.create(item)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy