mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-01 22:53:29 +08:00
Merge remote-tracking branch 'origin/swagger'
This commit is contained in:
17
bookshelfplus/.idea/runConfigurations/App.xml
generated
Normal file
17
bookshelfplus/.idea/runConfigurations/App.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="App" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="bookshelfplus" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="plus.bookshelf.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="plus.bookshelf.App" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
<option name="LaunchBrowser.Before.Run" url="http://localhost:8090/swagger-ui.html" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@@ -109,6 +109,29 @@
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>5.6.69</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger
|
||||
第一个是API获取的包,第二是官方给出的一个ui界面。三和四是spring boot 需要的jar包。
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import plus.bookshelf.Common.Enum.plus.bookshelf.TencentCloud.COS.CosProperties;
|
||||
|
@@ -0,0 +1,34 @@
|
||||
package plus.bookshelf.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.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("plus.bookshelf.Controller"))
|
||||
.paths(PathSelectors.any()).build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("书栖网 服务端接口文档")
|
||||
.description("RESTful API | bookshelf.plus")
|
||||
// .license("MIT")
|
||||
// .contact(new Contact("程序员小墨", "only4.work", "admin@only4.work"))
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
}
|
@@ -1,5 +1,8 @@
|
||||
package plus.bookshelf.Controller.Controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -11,6 +14,7 @@ import plus.bookshelf.Controller.VO.BookVO;
|
||||
import plus.bookshelf.Service.Model.BookModel;
|
||||
import plus.bookshelf.Service.Service.BookService;
|
||||
|
||||
@Api(value = "书籍")
|
||||
@Controller("book")
|
||||
@RequestMapping("/apiv1/book")
|
||||
public class BookController extends BaseController {
|
||||
@@ -18,6 +22,8 @@ public class BookController extends BaseController {
|
||||
@Autowired
|
||||
BookService bookService;
|
||||
|
||||
@ApiOperation(value = "获取书籍信息",notes = "获取书籍信息")
|
||||
// @ApiImplicitParam(name = "book", value = "图书详细实体", required = true, dataType = "Book")
|
||||
@RequestMapping(value = "get", method = {RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public BookVO get(@RequestParam(value = "id") Integer id) {
|
||||
|
Reference in New Issue
Block a user