refactor: 拆分接口文档分组配置及 controller 到各自模块

This commit is contained in:
2025-06-14 22:12:05 +08:00
parent f1a87b4c23
commit 93bd70dc5c
32 changed files with 257 additions and 80 deletions

View File

@@ -280,11 +280,9 @@ continew-admin
│ │ │ ├─ java/top/continew/admin
│ │ │ │ ├─ config (配置)
│ │ │ │ ├─ controller
│ │ │ │ │ ├─ auth系统认证相关 API
│ │ │ │ │ ├─ common通用相关 API
│ │ │ │ │ ─ monitor系统监控相关 API
│ │ │ │ │ ├─ system系统管理相关 API
│ │ │ │ │ └─ tool系统工具相关 API
│ │ │ │ │ ─ monitor系统监控相关 API
│ │ │ │ ├─ job (定时任务
│ │ │ │ └─ ContiNewAdminApplication.javaContiNew Admin 启动程序)
│ │ │ └─ resources
│ │ │ ├─ config核心配置目录
@@ -305,22 +303,28 @@ continew-admin
│ │ ├─ main
│ │ │ ├─ java/top/continew/admin
│ │ │ │ ├─ auth系统认证相关业务
│ │ │ │ │ ├─ controller系统认证相关 API
│ │ │ │ │ ├─ service系统认证相关业务接口及实现类
│ │ │ │ │ ├─ model系统认证相关模型
│ │ │ │ │ │ ├─ query系统认证相关查询条件
│ │ │ │ │ │ ├─ req系统认证相关请求对象Request
│ │ │ │ │ │ └─ resp系统认证相关响应对象Response
│ │ │ │ │ service系统认证相关业务接口及实现类
│ │ │ │ │ enums系统认证相关枚举
│ │ │ │ │ ├─ handler系统认证相关处理器
│ │ │ │ │ └─ config系统认证相关配置
│ │ │ │ └─ system系统管理相关业务
│ │ │ │ ├─ config(系统管理相关配置
│ │ │ │ ├─ enums系统管理相关枚举
│ │ │ │ ├─ controller(系统管理相关 API
│ │ │ │ ├─ service系统管理相关业务接口及实现类
│ │ │ │ ├─ mapper系统管理相关 Mapper
│ │ │ │ ├─ model系统管理相关模型
│ │ │ │ │ ├─ entity系统管理相关实体对象
│ │ │ │ │ ├─ query系统管理相关查询条件
│ │ │ │ │ ├─ req系统管理相关请求对象Request
│ │ │ │ │ └─ resp系统管理相关响应对象Response
│ │ │ │ ├─ service系统管理相关业务接口及实现类
│ │ │ │ ─ util系统管理相关工具类
│ │ │ │ ├─ enums系统管理相关枚举
│ │ │ │ ─ util系统管理相关工具类
│ │ │ │ ├─ validation系统管理相关参数校验工具类
│ │ │ │ └─ config系统管理相关配置
│ │ │ └─ resources
│ │ │ └─ mapper系统管理相关 Mapper XML 文件目录)
│ │ └─ test测试相关代码目录
@@ -329,60 +333,74 @@ continew-admin
│ ├─ continew-plugin-schedule任务调度插件模块
│ │ ├─ src
│ │ │ ├─ main/java/top/continew/admin/schedule
│ │ │ │ ├─ controller任务调度相关 API
│ │ │ │ ├─ service代码生成器相关业务接口及实现类
│ │ │ │ ├─ api任务调度中心相关 API
│ │ │ │ ├─ config任务调度相关配置
│ │ │ │ ├─ constant任务调度相关常量
│ │ │ │ ├─ enums任务调度相关枚举
│ │ │ │ ├─ model任务调度相关模型
│ │ │ │ │ ├─ query任务调度相关查询条件
│ │ │ │ │ ├─ req任务调度相关请求对象Request
│ │ │ │ │ └─ resp任务调度相关响应对象Response
│ │ │ │ service代码生成器相关业务接口及实现类
│ │ │ │ constant任务调度相关常量
│ │ │ │ ├─ enums任务调度相关枚举
│ │ │ │ ├─ exception任务调度相关异常
│ │ │ │ └─ config任务调度相关配置
│ │ │ └─ test测试相关代码目录
│ │ └─ pom.xml
│ ├─ continew-plugin-open能力开放插件模块
│ │ ├─ src
│ │ │ ├─ main/java/top/continew/admin/open
│ │ │ │ ├─ mapper代码生成器相关 Mapper
│ │ │ │ ├─ controller能力开放相关 API
│ │ │ │ ├─ service能力开放相关业务接口及实现类
│ │ │ │ ├─ mapper能力开放相关 Mapper
│ │ │ │ ├─ model能力开放相关模型
│ │ │ │ │ ├─ entity能力开放相关实体对象
│ │ │ │ │ ├─ query能力开放相关查询条件
│ │ │ │ │ ├─ req能力开放相关请求对象Request
│ │ │ │ │ └─ resp能力开放相关响应对象Response
│ │ │ │ service能力开放相关业务接口及实现类)
│ │ │ │ util能力开放相关工具类)
│ │ │ │ └─ config能力开放相关配置
│ │ │ └─ test测试相关代码目录
│ │ └─ pom.xml
│ ├─ continew-plugin-generator代码生成器插件模块
│ │ ├─ src
│ │ │ ├─ main
│ │ │ │ ├─ java/top/continew/admin/generator
│ │ │ │ │ ├─ config(代码生成器相关配置
│ │ │ │ │ ├─ enums(代码生成器相关枚举
│ │ │ │ │ ├─ controller(代码生成器相关 API
│ │ │ │ │ ├─ service(代码生成器相关业务接口及实现类
│ │ │ │ │ ├─ mapper代码生成器相关 Mapper
│ │ │ │ │ ├─ model代码生成器相关模型
│ │ │ │ │ │ ├─ entity代码生成器相关实体对象
│ │ │ │ │ │ ├─ query代码生成器相关查询条件
│ │ │ │ │ │ ├─ req代码生成器相关请求对象Request
│ │ │ │ │ │ └─ resp代码生成器相关响应对象Response
│ │ │ │ │ service(代码生成器相关业务接口及实现类
│ │ │ │ │ enums(代码生成器相关枚举
│ │ │ │ │ └─ config代码生成器相关配置
│ │ │ │ └─ resources
│ │ │ │ ─ templates/generator(代码生成相关模板目录)
│ │ │ │ ├─ application.yml代码生成配置文件
│ │ │ │ └─ generator.properties代码生成类型映射配置文件
│ │ │ │ ─ templates代码生成相关模板目录
│ │ │ │ ├─ backend后端模板目录
│ │ │ │ └─ frontend前端模板目录
│ │ │ └─ test测试相关代码目录
│ │ └─ pom.xml
│ └─ pom.xml
├─ continew-common公共模块存放公共工具类公共配置等
│ ├─ src
│ │ ├─ main/java/top/continew/admin/common
│ │ │ ├─ config公共配置
│ │ │ ├─ constant公共常量
│ │ │ ├─ enums公共枚举
│ │ │ ├─ controller控制器基类
│ │ │ ├─ service公共服务接口
│ │ │ ├─ model公共模型
│ │ │ │ ├─ dto公共 DTOData Transfer Object
│ │ │ │ ├─ req公共请求对象Request
│ │ │ │ └─ resp公共响应对象Response
│ │ │ util公共工具类
│ │ │ context公共上下文
│ │ │ ├─ constant公共常量
│ │ │ ├─ enums公共枚举
│ │ │ ├─ util公共工具类
│ │ │ └─ config公共配置
│ │ │ ├─ mybatisMyBatis Plus 配置)
│ │ │ ├─ websocketWebsocket 配置)
│ │ │ ├─ doc接口文档配置
│ │ │ ├─ excelExcel 配置)
│ │ │ └─ exception全局异常处理
│ │ └─ test测试相关代码目录
│ └─ pom.xml
├─ continew-extension扩展模块
@@ -408,7 +426,7 @@ continew-admin
├─ .idea
│ └─ icon.pngIDEA 项目图标,实际开发时直接删除)
├─ .image截图目录实际开发时直接删除
├─ .style代码格式、License文件头相关配置目录实际开发时根据需要取舍删除时注意删除 spotless 插件配置)
├─ .style代码格式、License文件头相关配置目录实际开发时根据需要取舍删除时注意删除 /pom.xml 中的 spotless 插件配置)
├─ .gitignoreGit 忽略文件相关配置文件)
├─ docker项目部署相关配置目录实际开发时可备份后直接删除
├─ LICENSE开源协议文件

View File

@@ -150,5 +150,11 @@
<groupId>top.continew</groupId>
<artifactId>continew-starter-json-jackson</artifactId>
</dependency>
<!-- ContiNew Starter 日志模块 - 拦截器版Spring Boot Actuator HttpTrace 增强版) -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-interceptor</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,43 @@
package top.continew.admin.common.config.doc;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 全局接口文档配置
*
* @author Charles7c
* @since 2025/6/14 21:22
*/
@Configuration
public class GlobalSpringDocConfiguration {
@Bean
public GroupedOpenApi allApi() {
return GroupedOpenApi.builder()
.group("all")
.displayName("全部接口")
.pathsToMatch("/**")
.packagesToExclude("/error")
.build();
}
@Bean
public GroupedOpenApi commonApi() {
return GroupedOpenApi.builder()
.group("common")
.displayName("通用接口")
.pathsToMatch("/common/**")
.build();
}
@Bean
public GroupedOpenApi monitorApi() {
return GroupedOpenApi.builder()
.group("monitor")
.displayName("系统监控")
.pathsToMatch("/monitor/**")
.build();
}
}

View File

@@ -14,4 +14,12 @@
<name>${project.artifactId}</name>
<description>代码生成器插件</description>
<dependencies>
<!-- 系统管理模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-system</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,27 @@
package top.continew.admin.generator.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 代码生成配置
*
* @author Charles7c
* @since 2025/6/14 21:22
*/
@Configuration
public class CodeConfiguration {
/**
* API 文档分组配置
*/
@Bean
public GroupedOpenApi codeApi() {
return GroupedOpenApi.builder()
.group("code")
.displayName("代码生成")
.pathsToMatch("/code/**")
.build();
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.code;
package top.continew.admin.generator.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -0,0 +1,27 @@
package top.continew.admin.open.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 能力开放配置
*
* @author Charles7c
* @since 2025/6/14 21:22
*/
@Configuration
public class OpenConfiguration {
/**
* API 文档分组配置
*/
@Bean
public GroupedOpenApi openApi() {
return GroupedOpenApi.builder()
.group("open")
.displayName("能力开放")
.pathsToMatch("/open/**")
.build();
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.open;
package top.continew.admin.open.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -0,0 +1,27 @@
package top.continew.admin.schedule.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 任务调度配置
*
* @author Charles7c
* @since 2025/6/14 21:22
*/
@Configuration
public class ScheduleConfiguration {
/**
* API 文档分组配置
*/
@Bean
public GroupedOpenApi scheduleApi() {
return GroupedOpenApi.builder()
.group("schedule")
.displayName("任务调度")
.pathsToMatch("/schedule/**")
.build();
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.schedule;
package top.continew.admin.schedule.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.schedule;
package top.continew.admin.schedule.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -52,12 +52,6 @@
<artifactId>continew-plugin-generator</artifactId>
</dependency>
<!-- ContiNew Starter 日志模块 - 拦截器版Spring Boot Actuator HttpTrace 增强版) -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-log-interceptor</artifactId>
</dependency>
<!-- ContiNew Starter 链路追踪模块 -->
<dependency>
<groupId>top.continew</groupId>

View File

@@ -114,33 +114,6 @@ springdoc:
# 设置对象型参数的展示形式(设为 true 表示将对象型参数平展开,即对象内的属性直接作为参数展示而不是嵌套在对象内,默认 false
# 如果不添加该全局配置,可以在需要如此处理的对象参数类上使用 @ParameterObject
default-flat-param-object: true
# 分组配置
group-configs:
- group: all
paths-to-match: /**
paths-to-exclude:
- /error
- group: auth
display-name: 系统认证
packages-to-scan: ${project.base-package}.controller.auth
- group: common
display-name: 通用接口
packages-to-scan: ${project.base-package}.controller.common
- group: system
display-name: 系统管理
packages-to-scan: ${project.base-package}.controller.system
- group: monitor
display-name: 系统监控
packages-to-scan: ${project.base-package}.controller.monitor
- group: schedule
display-name: 任务调度
packages-to-scan: ${project.base-package}.controller.schedule
- group: open
display-name: 能力开放
packages-to-scan: ${project.base-package}.controller.open
- group: code
display-name: 代码生成
packages-to-scan: ${project.base-package}.controller.code
## 组件配置
components:
# 鉴权配置

View File

@@ -0,0 +1,27 @@
package top.continew.admin.auth.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 系统认证配置
*
* @author Charles7c
* @since 2025/6/14 21:22
*/
@Configuration
public class AuthConfiguration {
/**
* API 文档分组配置
*/
@Bean
public GroupedOpenApi authApi() {
return GroupedOpenApi.builder()
.group("auth")
.displayName("系统认证")
.pathsToMatch("/auth/**")
.build();
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.auth;
package top.continew.admin.auth.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.StpUtil;

View File

@@ -0,0 +1,27 @@
package top.continew.admin.system.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 系统管理配置
*
* @author Charles7c
* @since 2025/6/14 21:22
*/
@Configuration
public class SystemConfiguration {
/**
* API 文档分组配置
*/
@Bean
public GroupedOpenApi systemApi() {
return GroupedOpenApi.builder()
.group("system")
.displayName("系统管理")
.pathsToMatch("/system/**")
.build();
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.feiniaojin.gracefulresponse.api.ExcludeFromGracefulResponse;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.hutool.core.collection.CollUtil;
import io.swagger.v3.oas.annotations.tags.Tag;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ReUtil;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.controller.system;
package top.continew.admin.system.controller;
import com.xkcoding.justauth.autoconfigure.JustAuthProperties;
import io.swagger.v3.oas.annotations.Operation;