Commit aee82c75976e3669680198ee9f44a8705ad092f7

Authored by 徐泉
1 parent 21d1bd0f
Exists in master

招生咨询会

pom.xml
... ... @@ -104,6 +104,11 @@
104 104 <artifactId>springfox-swagger-ui</artifactId>
105 105 <version>2.6.1</version>
106 106 </dependency>
  107 + <dependency>
  108 + <groupId>com.github.xiaoymin</groupId>
  109 + <artifactId>swagger-bootstrap-ui</artifactId>
  110 + <version>1.9.6</version>
  111 + </dependency>
107 112 </dependencies>
108 113  
109 114 <build>
... ...
src/main/java/com/sincere/student/Swagger2.java
1 1 package com.sincere.student;
2 2  
  3 +import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
3 4 import org.springframework.context.annotation.Bean;
4 5 import org.springframework.context.annotation.Configuration;
  6 +import org.springframework.context.annotation.Profile;
  7 +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
5 8 import springfox.documentation.builders.ApiInfoBuilder;
6 9 import springfox.documentation.builders.ParameterBuilder;
7 10 import springfox.documentation.builders.PathSelectors;
... ... @@ -17,8 +20,10 @@ import java.util.ArrayList;
17 20 import java.util.List;
18 21  
19 22 @EnableSwagger2
20   -@Configuration //让Spring来加载该类配置
21   -public class Swagger2 {
  23 +@Configuration
  24 +@Profile({"dev","test"})
  25 +@EnableSwaggerBootstrapUI
  26 +public class Swagger2 implements WebMvcConfigurer {
22 27  
23 28 @Bean
24 29 public Docket createRestApi() {
... ...
src/main/java/com/sincere/student/controller/SysYxController.java
... ... @@ -44,46 +44,6 @@ public class SysYxController {
44 44 }
45 45  
46 46  
47   -// /**
48   -// * 栏目相关接口
49   -// */
50   -// @MemberAccess
51   -// @ApiOperation("获取栏目列表(1 文章 2学校 3视频)")
52   -// @PostMapping(value = "/column/columnList")
53   -// public BaseDto<List<ColumnType>> columnList(@RequestBody ColumnDto columnDto) {
54   -// BaseDto<List<ColumnType>> result = new BaseDto<>();
55   -// ColumnEnums columnEnums = ColumnEnums.getByType(columnDto.getType());
56   -// if (columnEnums != null) {
57   -// List<ColumnType> data = sysYxColumnService.columnList(columnDto);
58   -// result.setData(data);
59   -// } else {
60   -// result.setSuccess(false);
61   -// result.setMessage("类型不匹配");
62   -// }
63   -// return result;
64   -// }
65   -
66   -// @ApiOperation("创建栏目(type : 1 文章 2学校 3视频)")
67   -// @PostMapping(value = "/addColumnType")
68   -// public BaseDto addColumnType(@RequestBody ColumnType columnType) {
69   -// BaseDto result = new BaseDto();
70   -// sysYxColumnService.addColumnType(columnType);
71   -// return result;
72   -// }
73   -//
74   -// @ApiOperation("更新栏目(type : 1 文章 2学校 3视频)")
75   -// @PostMapping(value = "/updateColumnType")
76   -// public BaseDto updateColumn(@RequestBody ColumnType columnType) {
77   -// BaseDto result = new BaseDto();
78   -// if (columnType.getId() > 0) {
79   -// sysYxColumnService.updateColumnType(columnType);
80   -// } else {
81   -// result.setSuccess(false);
82   -// result.setMessage("id没传");
83   -// }
84   -// return result;
85   -// }
86   -
87 47 @ApiOperation("获取咨询列表")
88 48 @RequestMapping(value = "/consultList", method = RequestMethod.POST)
89 49 public BaseDto<Page<SysYxSchoolConsult>> consultList(@RequestBody AddYxSchoolConsultVo vo) {
... ...
src/main/java/com/sincere/student/mapper/SysYxSchoolConsultMapper.java
... ... @@ -25,6 +25,4 @@ public interface SysYxSchoolConsultMapper {
25 25 int updateSort(SysYxSchoolConsult record);
26 26  
27 27 List<SysYxSchoolConsult> countConsultList(QueryCountYxSchoolConsult consult);
28   -
29   -// int getCountConsult(QueryCountYxSchoolConsult record);
30 28 }
31 29 \ No newline at end of file
... ...
src/main/resources/application.yaml
... ... @@ -2,6 +2,8 @@ server:
2 2 port: 9010
3 3  
4 4 spring:
  5 + profiles:
  6 + active: prod
5 7 application:
6 8 name: student
7 9 datasource:
... ... @@ -32,4 +34,12 @@ mybatis:
32 34 logging:
33 35 level:
34 36 com.sincere.student.mapper: info
35   -# com.sincere.student.mapper: DEBUG
36 37 \ No newline at end of file
  38 +# com.sincere.student.mapper: DEBUG
  39 +
  40 +#增加swagger文档访问验证
  41 +swagger:
  42 + production: false
  43 + basic:
  44 + enable: true
  45 + username: szdev
  46 + password: developer01
37 47 \ No newline at end of file
... ...