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

com.github.lsqlebai.curd.CURDController.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 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