将文档接口分开:管理端和用户端

This commit is contained in:
Bunny 2024-01-08 13:21:48 +08:00
parent 2a3d46113e
commit d6171e842d
2 changed files with 26 additions and 4 deletions

View File

@ -47,20 +47,42 @@ public class WebMvcConfiguration extends WebMvcConfigurationSupport {
/**
* 通过knife4j生成接口文档
*
* 管理后台文档
* @return Docket
*/
@Bean
public Docket docket() {
public Docket docketAdmin() {
ApiInfo apiInfo = new ApiInfoBuilder()
.title("苍穹外卖项目接口文档")
.version("2.0")
.description("苍穹外卖项目接口文档")
.build();
return new Docket(DocumentationType.SWAGGER_2)
.groupName("管理端接口")
.apiInfo(apiInfo)
.select()
.apis(RequestHandlerSelectors.basePackage("com.sky.controller"))
.apis(RequestHandlerSelectors.basePackage("com.sky.controller.admin"))
.paths(PathSelectors.any())
.build();
}
/**
* 通过knife4j生成接口文档
* 用户前台文档
* @return Docket
*/
@Bean
public Docket docketUser() {
ApiInfo apiInfo = new ApiInfoBuilder()
.title("苍穹外卖项目接口文档")
.version("2.0")
.description("苍穹外卖项目接口文档")
.build();
return new Docket(DocumentationType.SWAGGER_2)
.groupName("用户端接口")
.apiInfo(apiInfo)
.select()
.apis(RequestHandlerSelectors.basePackage("com.sky.controller.user"))
.paths(PathSelectors.any())
.build();
}

View File

@ -14,7 +14,7 @@ import javax.annotation.Resource;
@RestController("userShopController")
@RequestMapping("/admin/user")
@Api(tags = "用户店铺相关接口")
@Api(tags = "店铺相关接口")
@Slf4j
public class ShopController {
public static final String KEY = "SHOP_STATUS";