From 9867f6d5c5bccfe52b878c344c536905dd6b309e Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 09 六月 2022 08:48:06 +0800
Subject: [PATCH] 1. 接口文档自动输出

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
index 3903a77..825ac72 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
@@ -2,32 +2,58 @@
 
 import cn.flightfeather.supervision.domain.entity.Mediafile
 import cn.flightfeather.supervision.lightshare.service.MediafileService
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
 import org.springframework.web.bind.annotation.*
 import org.springframework.web.multipart.MultipartFile
+import springfox.documentation.annotations.ApiIgnore
 
+@Api(tags = ["澶氬獟浣撴枃浠禔PI鎺ュ彛"])
 @RestController
 @RequestMapping("/mediafile")
 class MediafileController (val mediafileService: MediafileService){
+    @ApiOperation(value = "鑾峰彇鎵�鏈夊濯掍綋鏂囦欢淇℃伅")
     @GetMapping
     fun getAll() = mediafileService.findAll()
 
+    @ApiOperation(value = "涓婁紶涓�涓濯掍綋鏂囦欢淇℃伅")
     @PutMapping
-    fun add(@RequestBody mediafile: Mediafile) = mediafileService.save(mediafile)
+    fun add(
+        @ApiParam("澶氬獟浣撴枃浠朵俊鎭�") @RequestBody mediafile: Mediafile)
+    = mediafileService.save(mediafile)
 
+    @ApiOperation(value = "鏇存柊涓�涓濯掍綋鏂囦欢淇℃伅")
     @PostMapping
-    fun update(@RequestBody mediafile: Mediafile) = mediafileService.update(mediafile)
+    fun update(
+        @ApiParam("澶氬獟浣撴枃浠朵俊鎭�") @RequestBody mediafile: Mediafile)
+    = mediafileService.update(mediafile)
 
+    @ApiOperation(value = "鏌ユ壘涓�涓濯掍綋鏂囦欢淇℃伅")
     @GetMapping("/{id}")
-    fun getById(@PathVariable id:String) = mediafileService.findOne(id)
+    fun getById(
+        @ApiParam("澶氬獟浣撴枃浠朵俊鎭痠d") @PathVariable id:String)
+    = mediafileService.findOne(id)
 
+    @ApiIgnore("椋炵窘鐩戠鍚庡彴绉绘鐨刟pi锛岃�冭檻鍚庣画鍒犻櫎")
+    @ApiOperation(value = "鏍规嵁瀛愪换鍔d鍙婁笟鍔$被鍨婭D鏌ヨ")
     @GetMapping("/{id}/{btid}")
-    fun getBySubtaskId(@PathVariable id:String,@PathVariable btid:String) = mediafileService.findBysubtaskbtid(id,btid)
+    fun getBySubtaskId(
+        @ApiParam("瀛愪换鍔d") @PathVariable id:String,
+        @ApiParam("涓氬姟绫诲瀷ID") @PathVariable btid:String)
+    = mediafileService.findBysubtaskbtid(id,btid)
 
+    @ApiIgnore
+    @ApiOperation(value = "鍒犻櫎涓�涓濯掍綋鏂囦欢淇℃伅")
     @DeleteMapping("/{id}")
-    fun delete (@PathVariable id: String) = mediafileService.delete(id)
+    fun delete (
+        @ApiParam("澶氬獟浣撴枃浠朵俊鎭痠d") @PathVariable id: String)
+    = mediafileService.delete(id)
 
+    @ApiOperation(value = "涓婁紶澶氬獟浣撴枃浠朵俊鎭�")
     @PostMapping("/add")
-    fun addProblem(@RequestParam("mediafileVoList") mediafileVoList: String, @RequestPart("Photos") files: Array<MultipartFile>) {
-        mediafileService.addMedifile(mediafileVoList,files)
-    }
+    fun addProblem(
+        @ApiParam("澶氬獟浣撴枃浠朵俊鎭痡son") @RequestParam("mediafileVoList") mediafileVoList: String,
+        @ApiParam("澶氬獟浣撴枃浠�") @RequestPart("Photos") files: Array<MultipartFile>
+    ) = mediafileService.addMedifile(mediafileVoList, files)
 }
\ No newline at end of file

--
Gitblit v1.9.3