From dd25573ebce3450d90d0012a30b12a5185bc7310 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 08 七月 2022 15:49:15 +0800 Subject: [PATCH] update 使用 @param 注释替换 @Parameter 注解 fix 修复 token 无法传递 与 无法持久化问题 --- ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java index 50bcbd0..b4b977a 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java @@ -20,11 +20,9 @@ import com.ruoyi.demo.domain.bo.TestDemoImportVo; import com.ruoyi.demo.domain.vo.TestDemoVo; import com.ruoyi.demo.service.ITestDemoService; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -43,7 +41,7 @@ * @date 2021-07-26 */ @Validated -@Tag(name ="娴嬭瘯鍗曡〃鎺у埗鍣�", description = "娴嬭瘯鍗曡〃绠$悊") +@Tag(name = "娴嬭瘯鍗曡〃鎺у埗鍣�", description = "娴嬭瘯鍗曡〃绠$悊") @RequiredArgsConstructor @RestController @RequestMapping("/demo/demo") @@ -69,12 +67,14 @@ return iTestDemoService.customPageList(bo, pageQuery); } - @Parameters({ - @Parameter(name = "file", description = "瀵煎叆鏂囦欢", in = ParameterIn.QUERY, required = true), - }) + /** + * 瀵煎叆鏁版嵁 + * + * @param file 瀵煎叆鏂囦欢 + */ @Log(title = "娴嬭瘯鍗曡〃", businessType = BusinessType.IMPORT) @SaCheckPermission("demo:demo:import") - @PostMapping("/importData") + @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception { ExcelResult<TestDemoImportVo> excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true); List<TestDemoImportVo> volist = excelResult.getList(); @@ -100,12 +100,13 @@ /** * 鑾峰彇娴嬭瘯鍗曡〃璇︾粏淇℃伅 + * + * @param id 娴嬭瘯ID */ @SaCheckPermission("demo:demo:query") @GetMapping("/{id}") - public R<TestDemoVo> getInfo(@Parameter(name = "娴嬭瘯ID") - @NotNull(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable("id") Long id) { + public R<TestDemoVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { return R.ok(iTestDemoService.queryById(id)); } @@ -136,13 +137,14 @@ /** * 鍒犻櫎娴嬭瘯鍗曡〃 + * + * @param ids 娴嬭瘯ID涓� */ @SaCheckPermission("demo:demo:remove") @Log(title = "娴嬭瘯鍗曡〃", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public R<Void> remove(@Parameter(name = "娴嬭瘯ID涓�") - @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable Long[] ids) { + public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); } } -- Gitblit v1.9.3