com.github.lsqlebai.curd.DefaultCURDServiceImpl.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 DefaultCURDServiceImpl- : CURDService
- , InitializingBean {
lateinit var curdMapper: CURDMapper
-
fun init(mapper: CURDMapper
- ) {
this.curdMapper = mapper
}
@GetMapping("/")
override fun listAll(): List
- {
return curdMapper.listAll()
}
@GetMapping("/list/{id}")
override fun listByParent(@PathVariable id: Int): List
- {
return curdMapper.listByParent(id)
}
@DeleteMapping("/{id}")
override fun delete(@PathVariable id: Int) {
return curdMapper.delete(id)
}
@PutMapping("/")
override fun update(@RequestBody item: Item): Item? {
curdMapper.update(item)
return item
}
@PostMapping("/")
override fun create(@RequestBody item: Item): Item? {
curdMapper.create(item)
return item
}
@GetMapping("/{id}")
override fun one(@PathVariable id: Int): Item? {
return curdMapper.one(id)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy