From 7802008a346d5b4bce23fab42442b0b784bfbb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E8=B6=85?= Date: Fri, 19 Feb 2021 20:33:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4knifej4=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=8A=82=E7=82=B9=20basic-error-controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/qiwenshare/common/cbb/RestResult.java | 6 ++++++ .../file/config/openapi/OpenAPIConfig.java | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/file-common/src/main/java/com/qiwenshare/common/cbb/RestResult.java b/file-common/src/main/java/com/qiwenshare/common/cbb/RestResult.java index f16bcd3..d1828d6 100644 --- a/file-common/src/main/java/com/qiwenshare/common/cbb/RestResult.java +++ b/file-common/src/main/java/com/qiwenshare/common/cbb/RestResult.java @@ -1,5 +1,6 @@ package com.qiwenshare.common.cbb; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.util.Map; @@ -9,10 +10,15 @@ import java.util.Map; * @param */ @Data +@Schema(name = "统一结果返回",required = true) public class RestResult { + @Schema(description = "请求是否成功", example = "true") private Boolean success = true; + @Schema(description = "返回码", example = "20000") private Integer code; + @Schema(description = "返回信息", example = "成功") private String message; + @Schema(description = "返回数据") private T data; // 通用返回成功 diff --git a/file-web/src/main/java/com/qiwenshare/file/config/openapi/OpenAPIConfig.java b/file-web/src/main/java/com/qiwenshare/file/config/openapi/OpenAPIConfig.java index f4119cb..32bd4f1 100644 --- a/file-web/src/main/java/com/qiwenshare/file/config/openapi/OpenAPIConfig.java +++ b/file-web/src/main/java/com/qiwenshare/file/config/openapi/OpenAPIConfig.java @@ -6,6 +6,10 @@ import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; @Configuration @@ -22,4 +26,13 @@ public class OpenAPIConfig { .description("奇文网盘gitee地址") .url("https://www.gitee.com/qiwen-cloud/qiwen-file")); } + + @Bean + public Docket demoApi() { + return new Docket(DocumentationType.OAS_30) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.regex("(?!/error.*).*")) + .build(); + } } From c004a06da5922599f93daaa9f9a3f683f28f82f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E8=B6=85?= Date: Sat, 20 Feb 2021 12:58:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/qiwenshare/file/controller/RecoveryFileController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file-web/src/main/java/com/qiwenshare/file/controller/RecoveryFileController.java b/file-web/src/main/java/com/qiwenshare/file/controller/RecoveryFileController.java index a4d00f3..c2e5d26 100644 --- a/file-web/src/main/java/com/qiwenshare/file/controller/RecoveryFileController.java +++ b/file-web/src/main/java/com/qiwenshare/file/controller/RecoveryFileController.java @@ -104,7 +104,7 @@ public class RecoveryFileController { String fileName = filePath.substring(filePath.lastIndexOf("/") + 1); filePath = PathUtil.getParentPath(filePath); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(UserFile::getFilePath, filePath) + lambdaQueryWrapper.eq(UserFile::getFilePath, filePath + "/") .eq(UserFile::getDeleteFlag, 0) .eq(UserFile::getUserId, sessionUserBean.getUserId()); List userFileList = userFileService.list(lambdaQueryWrapper);