feat:文档分组
This commit is contained in:
parent
e22e1b366a
commit
6841e2c7da
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
@ -7,12 +7,26 @@ spring:
|
|||
username: admin_server
|
||||
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:
|
||||
enable: true
|
||||
setting:
|
||||
language: zh-CN
|
||||
documents:
|
||||
- group: 默认分组
|
||||
name: Knife4j官方文档
|
||||
locations:
|
||||
- com.example.admin_server.controller
|
||||
language: zh_cn
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue