package cn.flightfeather.supervision.lightshare.web
|
|
import cn.flightfeather.supervision.domain.ds1.entity.Town
|
import cn.flightfeather.supervision.lightshare.service.TownService
|
import io.swagger.annotations.Api
|
import org.springframework.web.bind.annotation.*
|
|
@Api(tags = ["TownController"], description = "街镇API接口")
|
@RestController
|
@RequestMapping("/town")
|
class TownController(val townService: TownService){
|
@GetMapping
|
fun getAll() = townService.findAll()
|
|
@PutMapping
|
fun add(@RequestBody town: Town) = townService.save(town)
|
|
@PostMapping
|
fun update(@RequestBody town: Town) = townService.update(town)
|
|
@GetMapping("/{id}")
|
fun getById(@PathVariable id:String) = townService.findOne(id)
|
|
@DeleteMapping("/{id}")
|
fun delete (@PathVariable id: String) = townService.delete(id)
|
}
|