增加Swagger接口文档
This commit is contained in:
@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -24,7 +25,8 @@ import java.util.Map;
|
||||
public class YxtYythmallApplication {
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext context = SpringApplication.run(YxtYythmallApplication.class, args);
|
||||
Map<String, Object> beansWithAnnotation = context.getBeansWithAnnotation(RestController.class);
|
||||
Map<String, Object> beansWithAnnotation = context.getBeansWithAnnotation(Controller.class);
|
||||
beansWithAnnotation.forEach((k, v) -> System.out.println(k + ":" + v));
|
||||
System.out.println("启动成功==================================");
|
||||
}
|
||||
}
|
||||
|
||||
67
src/main/java/com/yxt/yythmall/config/Swagger2Config.java
Normal file
67
src/main/java/com/yxt/yythmall/config/Swagger2Config.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*********************************************************
|
||||
*********************************************************
|
||||
******************** *******************
|
||||
************* ************
|
||||
******* _oo0oo_ *******
|
||||
*** o8888888o ***
|
||||
* 88" . "88 *
|
||||
* (| -_- |) *
|
||||
* 0\ = /0 *
|
||||
* ___/`---'\___ *
|
||||
* .' \\| |// '. *
|
||||
* / \\||| : |||// \ *
|
||||
* / _||||| -:- |||||- \ *
|
||||
* | | \\\ - /// | | *
|
||||
* | \_| ''\---/'' |_/ | *
|
||||
* \ .-\__ '-' ___/-. / *
|
||||
* ___'. .' /--.--\ `. .'___ *
|
||||
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||
* `=---=' *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||
*********************************************************/
|
||||
package com.yxt.yythmall.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Project: ordermall_yuncaijiao_admin <br/>
|
||||
* File: Swagger2Config.java <br/>
|
||||
* Class: com.yxt.yythmall.config.Swagger2Config <br/>
|
||||
* Description: <描述类的功能>. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2025/8/20 14:16 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class Swagger2Config {
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo()).select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.yxt"))
|
||||
.paths(PathSelectors.any()).build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder().title("预约系统").description("商品预订采购管理").version("1.0")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,14 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsAlbumController", description = "管理")
|
||||
@Api(tags = "管理相册", description = "管理")
|
||||
@RequestMapping("/pms/PmsAlbum")
|
||||
public class PmsAlbumController {
|
||||
@Resource
|
||||
private IPmsAlbumService IPmsAlbumService;
|
||||
|
||||
// // @SysLog(MODULE = "pms", REMARK = "查询pms_album表")
|
||||
@ApiOperation("查询pms_album表")
|
||||
@ApiOperation("查询相册表")
|
||||
@GetMapping(value = "/list")
|
||||
|
||||
public Object getPmsAlbumByPage(PmsAlbum entity,
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yythmall.biz.appletbanner.AppletBanner;
|
||||
import com.yxt.yythmall.biz.appletbanner.AppletBannerService;
|
||||
import com.yxt.yythmall.wxapi.vo.WxBannerListVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "微信端轮播图")
|
||||
@RestController("om.yxt.yythmall.wxapi.WxBannerRest")
|
||||
@RequestMapping("/wxapi/banner")
|
||||
public class WxBannerRest {
|
||||
@@ -19,6 +22,7 @@ public class WxBannerRest {
|
||||
@Autowired
|
||||
private AppletBannerService appletBannerService;
|
||||
|
||||
@ApiOperation("轮播图列表")
|
||||
@GetMapping("/list")
|
||||
public ResultBean<List<WxBannerListVo>> list() {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
@@ -26,6 +30,7 @@ public class WxBannerRest {
|
||||
return rb.success().setData(list);
|
||||
}
|
||||
|
||||
@ApiOperation("通过ID获取轮播图")
|
||||
@GetMapping("/banner/{sid}")
|
||||
public ResultBean<AppletBanner> fetchBySid(@PathVariable("sid") String sid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
|
||||
Reference in New Issue
Block a user