From 3e2159e45e12b2b8af058b68eafeaf082cf3fe85 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 15 九月 2022 09:30:31 +0800
Subject: [PATCH] 2022.9.15 1. 根据微信小程序前端需求,添加各对应后台逻辑

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt |   66 ++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 17 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
index d028f4b..95f390a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
@@ -6,6 +6,7 @@
 import cn.flightfeather.supervision.lightshare.vo.UserSearchCondition
 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 javax.servlet.http.HttpServletResponse
@@ -17,58 +18,89 @@
 //    @GetMapping("")
 //    fun getAll() = userinfoService.findAll()
 
+    @ApiOperation(value = "鏍规嵁鐢ㄦ埛id鑾峰彇鐢ㄦ埛淇℃伅")
     @GetMapping("/{id}")
-    fun getById(@PathVariable id: String) = userinfoService.findOne(id)
+    fun getById(
+        @ApiParam("鐢ㄦ埛id") @PathVariable id: String
+    ) = userinfoService.findOne(id)
 
+    @ApiOperation(value = "涓婁紶鐢ㄦ埛淇℃伅")
     @PutMapping("")
-    fun add(@RequestBody userinfo: Userinfo) = userinfoService.save(userinfo)
+    fun add(
+        @ApiParam("鐢ㄦ埛淇℃伅") @RequestBody userinfo: Userinfo
+    ) = userinfoService.save(userinfo)
 
+    @ApiOperation(value = "鏇存柊鐢ㄦ埛淇℃伅")
     @PostMapping("")
-    fun update(@RequestBody userinfo: Userinfo) = userinfoService.update(userinfo)
+    fun update(
+        @ApiParam("鐢ㄦ埛淇℃伅") @RequestBody userinfo: Userinfo
+    ) = userinfoService.update(userinfo)
 
 //    @DeleteMapping("/{id}")
 //    fun delete(@PathVariable id: String) = userinfoService.delete(id)
 
     @ApiOperation(value = "鐧诲綍")
     @PostMapping("/login")
-    fun login(@RequestBody loginRequestVo: LoginRequestVo) = userinfoService.login(loginRequestVo)
+    fun login(
+        @ApiParam("鐧诲綍淇℃伅") @RequestBody loginRequestVo: LoginRequestVo
+    ) = userinfoService.login(loginRequestVo)
 
     @ApiOperation(value = "娉ㄥ唽")
     @PostMapping("/register")
-    fun register(@RequestBody loginRequestVo: LoginRequestVo) = userinfoService.register(loginRequestVo)
+    fun register(
+        @ApiParam("娉ㄥ唽淇℃伅") @RequestBody loginRequestVo: LoginRequestVo
+    ) = userinfoService.register(loginRequestVo)
+
+    @ApiOperation(value = "娉ㄥ唽")
+    @PostMapping("/register2")
+    fun register2(
+        @ApiParam("娉ㄥ唽淇℃伅") @RequestBody loginRequestVo: LoginRequestVo
+    ) = userinfoService.register2(loginRequestVo)
 
     @ApiOperation(value = "鑾峰彇鐢ㄦ埛閫氳褰�")
     @GetMapping("/addressBook")
-    fun getAddressBook(@RequestParam("userId") userId: String) = userinfoService.getAddressBook(userId)
+    fun getAddressBook(
+        @ApiParam("鐢ㄦ埛id") @RequestParam("userId") userId: String
+    ) = userinfoService.getAddressBook(userId)
 
     @ApiOperation(value = "涓婁紶鐢ㄦ埛澶村儚")
     @PostMapping("/accountPic/upLoad")
     fun upLoadUserAccountPic(
-            @RequestParam("userId") userId: String,
-            @RequestPart("images") files: Array<MultipartFile>
+        @ApiParam("鐢ㄦ埛id") @RequestParam("userId") userId: String,
+        @ApiParam("鍥剧墖") @RequestPart("images") files: Array<MultipartFile>
     ) = userinfoService.upLoadAccountPic(userId, files)
 
     @ApiOperation(value = "淇敼瀵嗙爜")
     @PostMapping("/password/change/{userId}")
     fun changePassword(
-            @RequestParam("userId") userId: String,
-            @RequestParam("oldPassword") oldPassword: String,
-            @RequestParam("newPassword") newPassword: String
+        @ApiParam("鐢ㄦ埛id") @RequestParam("userId") userId: String,
+        @ApiParam("鏃у瘑鐮�") @RequestParam("oldPassword") oldPassword: String,
+        @ApiParam("鏂板瘑鐮�") @RequestParam("newPassword") newPassword: String
     ) = userinfoService.changePassword(userId, oldPassword, newPassword)
 
     @ApiOperation(value = "鏍规嵁鏌ヨ鑰咃紝鎵惧埌鍚屽尯鍘跨殑鐢ㄦ埛")
     @PostMapping("/searchUser/{userId}")
     fun searchUser(
-            @PathVariable("userId") userId: String,
-            @RequestBody condition: UserSearchCondition,
-            @RequestParam(value = "page") page: Int,
-            @RequestParam(value = "per_page") perPage: Int,
-            response: HttpServletResponse
+        @ApiParam("鐢ㄦ埛id") @PathVariable("userId") userId: String,
+        @ApiParam("鏌ヨ鏉′欢") @RequestBody condition: UserSearchCondition,
+        @ApiParam("椤电爜") @RequestParam(value = "page") page: Int,
+        @ApiParam("鍗曢〉鏁版嵁閲�") @RequestParam(value = "per_page") perPage: Int,
+        response: HttpServletResponse
     ) = userinfoService.searchUser(userId, condition, page, perPage, response)
 
     @ApiOperation(value = "鑾峰彇鐢ㄦ埛鍩烘湰淇℃伅")
     @GetMapping("/baseInfo")
     fun getBaseInfo(
-            @RequestParam("userId") userId: String
+        @ApiParam("鐢ㄦ埛id") @RequestParam("userId") userId: String
     ) = userinfoService.getBaseInfo(userId)
+
+    @ApiOperation(value = "鏍规嵁缁欏畾鏉′欢锛屾悳绱㈢敤鎴�")
+    @GetMapping("/search")
+    fun search(
+        @ApiParam("鍖哄幙", example = "寰愭眹鍖�") @RequestParam("district", required = false) district: String,
+        @ApiParam("鍦烘櫙绫诲瀷", example = "1", allowableValues = "0,1,2,3,4,5,6,7") @RequestParam("sceneType", required = false) sceneType: Int,
+        @ApiParam("鐢ㄦ埛绫诲瀷", example = "0", allowableValues = "0,1,2,3") @RequestParam("userType", required = false) userType: Int,
+        @ApiParam("椤电爜") @RequestParam(value = "page") page: Int,
+        @ApiParam("鍗曢〉鏁版嵁閲�") @RequestParam(value = "per_page") perPage: Int,
+    ) = userinfoService.search(district, sceneType, userType, page, perPage)
 }
\ No newline at end of file

--
Gitblit v1.9.3