All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lsqlebai.curd.DefaultCURDServiceImpl.kt Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
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