<!-- swagger 生成接口文档 用doc.html好点-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<!--此处是 /swagger-ui.html-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<!--这里是doc.html-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
ApiInfo apiInfo = new ApiInfoBuilder()
.title("项目名称")
.description("项目名称swagger RESTful APIs......")
.version("1.0")
.contact(new Contact("张三","https://",".com"))
.license("The Apache License")
.licenseUrl("http://www.baidu.com")
.build();
return new Docket(DocumentationType.SWAGGER_2)
.pathMapping("/")
.select()
.apis(RequestHandlerSelectors.basePackage("com.zhch.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo);
}
}
@RestController
@Api(value="测试类数值",tags = "测试类数值1")
public class Zj2Controller {
@Resource
private IZj2Service zj2Service;
@ApiOperation(value="模型总表信息",notes="模型总表信息,分页查询",response=String.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "分页的起始页", required = true, dataType = "String"),
@ApiImplicitParam(name = "limit", value = "每页显示的数量", required = true, dataType = "String")
})
@GetMapping("/select/one")
public Result sub(@RequestParam(value = "name") @NotNull String name){
return Result.success(zj2Service.getName(new JSONArray()));
}