feat:文档分组

This commit is contained in:
FalingCliff 2025-05-23 21:53:25 +08:00
parent e22e1b366a
commit 6841e2c7da
5 changed files with 77 additions and 21 deletions

View File

@ -1,15 +0,0 @@
package com.example.admin_server.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class MainController {
@GetMapping("/welcome")
public String welcome(){
return "Hello World";
}
}

View File

@ -0,0 +1,19 @@
package com.example.admin_server.controller.admin;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/admin")
@Tag(name = "AdminMain")
public class AdminMainController {
@GetMapping("/welcome")
@Operation(summary = "Hello admin")
public String welcome(){
return "Hello admin";
}
}

View File

@ -0,0 +1,19 @@
package com.example.admin_server.controller.client;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/client")
@Tag(name = "ClientMain")
public class ClientMainController {
@GetMapping("/welcome")
@Operation(summary = "Hello client")
public String welcome(){
return "Hello client";
}
}

View File

@ -0,0 +1,19 @@
package com.example.admin_server.controller.employee;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/employee")
@Tag(name = "EmployeeMain", description = "welcome")
public class EmployeeMainController {
@GetMapping("/welcome")
@Operation(summary = "Hello employee")
public String welcome() {
return "Hello employee";
}
}

View File

@ -7,12 +7,26 @@ spring:
username: admin_server username: admin_server
password: iyzHSPYE3DzEThsY password: iyzHSPYE3DzEThsY
springdoc:
swagger-ui:
path: /swagger-ui.html
tags-sorter: alpha
operations-sorter: alpha
api-docs:
path: /v3/api-docs
group-configs:
- group: '管理端'
paths-to-match: '/api/admin/**'
packages-to-scan: com.example.admin_server.controller.admin
- group: '客户端'
paths-to-match: '/api/client/**'
packages-to-scan: com.example.admin_server.controller.client
- group: '员工端'
paths-to-match: '/api/employee/**'
packages-to-scan: com.example.admin_server.controller.employee
knife4j: knife4j:
enable: true enable: true
setting: setting:
language: zh-CN language: zh_cn
documents:
- group: 默认分组
name: Knife4j官方文档
locations:
- com.example.admin_server.controller