package cn.flightfeather.supervision.lightshare.web
|
|
import cn.flightfeather.supervision.domain.entity.Mediafile
|
import cn.flightfeather.supervision.lightshare.service.MediafileService
|
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.multipart.MultipartFile
|
|
@RestController
|
@RequestMapping("/mediafile")
|
class MediafileController (val mediafileService: MediafileService){
|
@GetMapping
|
fun getAll() = mediafileService.findAll()
|
|
@PutMapping
|
fun add(@RequestBody mediafile: Mediafile) = mediafileService.save(mediafile)
|
|
@PostMapping
|
fun update(@RequestBody mediafile: Mediafile) = mediafileService.update(mediafile)
|
|
@GetMapping("/{id}")
|
fun getById(@PathVariable id:String) = mediafileService.findOne(id)
|
|
@GetMapping("/{id}/{btid}")
|
fun getBySubtaskId(@PathVariable id:String,@PathVariable btid:String) = mediafileService.findBysubtaskbtid(id,btid)
|
|
@DeleteMapping("/{id}")
|
fun delete (@PathVariable id: String) = mediafileService.delete(id)
|
|
@PostMapping("/add")
|
fun addProblem(@RequestParam("mediafileVoList") mediafileVoList: String, @RequestPart("Photos") files: Array<MultipartFile>) {
|
mediafileService.addMedifile(mediafileVoList,files)
|
}
|
}
|