From aed297a5fbc8df9dab01b28da21f872ee546b43c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 13 十月 2025 16:15:11 +0800
Subject: [PATCH] 2025.10.13 1. 统一调整controller层的返回类型,通过添加全局响应增强器GlobalResponseAdvice来管理返回结果; 2. 新增mybatis-generator自定义插件,实现给数据库实体entity自动添加swagger注解@ApiModel和@ApiModelProperty

---
 src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt b/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
index 7a159fe..372623a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.config
 
+import io.swagger.annotations.Api
 import org.springframework.beans.factory.annotation.Value
 import org.springframework.context.annotation.Bean
 import org.springframework.context.annotation.Configuration
@@ -13,12 +14,13 @@
 /**
  * @author riku
  * Date: 2020/8/28
+ * 璁块棶鍦板潃锛歨ttp://localhost:8080/swagger-ui/index.html
  */
 @Configuration
 @EnableSwagger2
 class Swagger2Configuration(
     @Value("\${springfox.documentation.swagger.v2.enabled}")
-    var swagger2Enable: Boolean
+    var swagger2Enable: Boolean,
 ) {
 
     companion object {
@@ -29,19 +31,20 @@
 
     @Bean
     fun createRestApi(): Docket =
-            Docket(DocumentationType.SWAGGER_2)
-                    .enable(swagger2Enable)
-                    .apiInfo(apiInfo())
-                    .select()
-                    .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE))
-                    .paths(PathSelectors.any())
-                    .build()
+        Docket(DocumentationType.SWAGGER_2)
+            .enable(swagger2Enable)
+            .apiInfo(apiInfo())
+            .select()
+            .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE))
+            .apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
+            .paths(PathSelectors.any())
+            .build()
 
 
     private fun apiInfo() =
-            ApiInfoBuilder()
-                    .title("绗笁鏂圭洃绠℃湇鍔�")
-                    .description("绗笁鏂圭洃绠℃湇鍔� API 鎺ュ彛鏂囨。")
-                    .version(VERSION)
-                    .build()
+        ApiInfoBuilder()
+            .title("绗笁鏂圭洃绠℃湇鍔�")
+            .description("绗笁鏂圭洃绠℃湇鍔� API 鎺ュ彛鏂囨。")
+            .version(VERSION)
+            .build()
 }
\ No newline at end of file

--
Gitblit v1.9.3