Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit baf8bca

Browse files
committed
使用 showdoc 生成接口文档
1 parent 45da129 commit baf8bca

File tree

7 files changed

+124
-1
lines changed

7 files changed

+124
-1
lines changed

‎lab-24/lab-24-apidoc-showdoc/pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.2.11.RELEASE</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<artifactId>lab-24-apidoc-showdoc</artifactId>
14+
15+
<dependencies>
16+
<!-- 实现对 Spring MVC 的自动化配置 -->
17+
<dependency>
18+
<groupId>org.springframework.boot</groupId>
19+
<artifactId>spring-boot-starter-web</artifactId>
20+
</dependency>
21+
</dependencies>
22+
23+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package cn.iocoder.springboot.lab24.apidoc;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class ShowDocApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(ShowDocApplication.class, args);
11+
}
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package cn.iocoder.springboot.lab24.apidoc.controller;
2+
3+
import cn.iocoder.springboot.lab24.apidoc.controller.vo.UserLoginReqVO;
4+
import cn.iocoder.springboot.lab24.apidoc.controller.vo.UserLoginRespVO;
5+
import org.springframework.web.bind.annotation.*;
6+
7+
import java.util.ArrayList;
8+
9+
@RestController
10+
@RequestMapping("/users")
11+
public class UserController {
12+
13+
@PostMapping("/login")
14+
public UserLoginRespVO login(@RequestBody UserLoginReqVO reqVO) {
15+
UserLoginRespVO respVO = new UserLoginRespVO();
16+
respVO.setUserId(1024);
17+
respVO.setUsername(reqVO.getUsername());
18+
respVO.setName("芋道源码");
19+
return respVO;
20+
}
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package cn.iocoder.springboot.lab24.apidoc.controller.vo;
2+
3+
public class UserLoginReqVO {
4+
5+
private String username;
6+
7+
private String password;
8+
9+
public String getUsername() {
10+
return username;
11+
}
12+
13+
public UserLoginReqVO setUsername(String username) {
14+
this.username = username;
15+
return this;
16+
}
17+
18+
public String getPassword() {
19+
return password;
20+
}
21+
22+
public UserLoginReqVO setPassword(String password) {
23+
this.password = password;
24+
return this;
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package cn.iocoder.springboot.lab24.apidoc.controller.vo;
2+
3+
public class UserLoginRespVO {
4+
5+
private Integer userId;
6+
7+
private String name;
8+
9+
private String username;
10+
11+
public Integer getUserId() {
12+
return userId;
13+
}
14+
15+
public UserLoginRespVO setUserId(Integer userId) {
16+
this.userId = userId;
17+
return this;
18+
}
19+
20+
public String getName() {
21+
return name;
22+
}
23+
24+
public UserLoginRespVO setName(String name) {
25+
this.name = name;
26+
return this;
27+
}
28+
29+
public String getUsername() {
30+
return username;
31+
}
32+
33+
public UserLoginRespVO setUsername(String username) {
34+
this.username = username;
35+
return this;
36+
}
37+
38+
}

‎lab-24/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<module>lab-24-apidoc-swagger-knife4j</module>
1717
<module>lab-24-apidoc-japidocs</module>
1818
<module>lab-24-apidoc-swagger-starter</module>
19+
<module>lab-24-apidoc-showdoc</module>
1920
</modules>
2021

2122

‎pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<!-- <module>lab-21</module>-->
3232
<!-- <module>lab-22</module>-->
3333
<!-- <module>lab-23</module>-->
34-
<!-- <module>lab-24</module>-->
34+
<module>lab-24</module>
3535
<!-- <module>lab-25</module>-->
3636
<!-- <module>lab-26</module>-->
3737
<!-- <module>lab-27</module>-->

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /