Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apidoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
apidoc
Commits
ec4188d8
Commit
ec4188d8
authored
May 19, 2020
by
duanledexianxianxian
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码重构
parent
ca53f41f
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
122 additions
and
31 deletions
+122
-31
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/ArrayTypeDescription.java
.../apidoc/core/common/description/ArrayTypeDescription.java
+2
-0
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/ObjectTypeDescription.java
...apidoc/core/common/description/ObjectTypeDescription.java
+8
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/PrimitiveTypeDescription.java
...doc/core/common/description/PrimitiveTypeDescription.java
+2
-0
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/StringTypeDescription.java
...apidoc/core/common/description/StringTypeDescription.java
+3
-0
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/TypeDescription.java
...nglun/apidoc/core/common/description/TypeDescription.java
+9
-7
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/UnAvailableTypeDescription.java
...c/core/common/description/UnAvailableTypeDescription.java
+3
-0
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/render/MarkdownRender.java
...hub/fengyuchenglun/apidoc/core/render/MarkdownRender.java
+1
-0
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Appendix.java
...om/github/fengyuchenglun/apidoc/core/schema/Appendix.java
+4
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Book.java
...va/com/github/fengyuchenglun/apidoc/core/schema/Book.java
+4
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Cell.java
...va/com/github/fengyuchenglun/apidoc/core/schema/Cell.java
+2
-0
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Chapter.java
...com/github/fengyuchenglun/apidoc/core/schema/Chapter.java
+4
-3
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Header.java
.../com/github/fengyuchenglun/apidoc/core/schema/Header.java
+2
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Node.java
...va/com/github/fengyuchenglun/apidoc/core/schema/Node.java
+3
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Project.java
...com/github/fengyuchenglun/apidoc/core/schema/Project.java
+4
-3
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Row.java
...ava/com/github/fengyuchenglun/apidoc/core/schema/Row.java
+1
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Section.java
...com/github/fengyuchenglun/apidoc/core/schema/Section.java
+4
-2
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Tag.java
...ava/com/github/fengyuchenglun/apidoc/core/schema/Tag.java
+2
-2
apidoc-springmvc/src/main/java/com/github/fengyuchenglun/apidoc/springmvc/SpringParser.java
.../github/fengyuchenglun/apidoc/springmvc/SpringParser.java
+2
-0
apidoc-springmvc/src/test/java/com/github/fengyuchenglun/example/spring/advanced/UserController.java
...engyuchenglun/example/spring/advanced/UserController.java
+62
-2
No files found.
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/ArrayTypeDescription.java
View file @
ec4188d8
...
@@ -3,6 +3,7 @@ package com.github.fengyuchenglun.apidoc.core.common.description;
...
@@ -3,6 +3,7 @@ package com.github.fengyuchenglun.apidoc.core.common.description;
import
com.github.fengyuchenglun.apidoc.core.common.ObjectMappers
;
import
com.github.fengyuchenglun.apidoc.core.common.ObjectMappers
;
import
com.github.fengyuchenglun.apidoc.core.schema.Row
;
import
com.github.fengyuchenglun.apidoc.core.schema.Row
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -10,6 +11,7 @@ import java.util.Collection;
...
@@ -10,6 +11,7 @@ import java.util.Collection;
/**
/**
* 数组类型描述
* 数组类型描述
*/
*/
@Data
public
class
ArrayTypeDescription
extends
TypeDescription
{
public
class
ArrayTypeDescription
extends
TypeDescription
{
protected
ArrayNode
value
;
protected
ArrayNode
value
;
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/ObjectTypeDescription.java
View file @
ec4188d8
...
@@ -4,6 +4,7 @@ import com.github.fengyuchenglun.apidoc.core.common.ObjectMappers;
...
@@ -4,6 +4,7 @@ import com.github.fengyuchenglun.apidoc.core.common.ObjectMappers;
import
com.github.fengyuchenglun.apidoc.core.schema.Row
;
import
com.github.fengyuchenglun.apidoc.core.schema.Row
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -16,8 +17,7 @@ import java.util.List;
...
@@ -16,8 +17,7 @@ import java.util.List;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@Setter
@Data
@Getter
public
class
ObjectTypeDescription
extends
TypeDescription
{
public
class
ObjectTypeDescription
extends
TypeDescription
{
/**
/**
...
@@ -29,6 +29,12 @@ public class ObjectTypeDescription extends TypeDescription {
...
@@ -29,6 +29,12 @@ public class ObjectTypeDescription extends TypeDescription {
*/
*/
private
ObjectNode
value
=
ObjectMappers
.
instance
.
createObjectNode
();
private
ObjectNode
value
=
ObjectMappers
.
instance
.
createObjectNode
();
@Override
public
void
setRequired
(
Boolean
required
)
{
this
.
required
=
required
;
this
.
members
.
get
(
0
).
setRequired
(
required
);
}
/**
/**
* Merge.
* Merge.
*
*
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/PrimitiveTypeDescription.java
View file @
ec4188d8
...
@@ -2,10 +2,12 @@ package com.github.fengyuchenglun.apidoc.core.common.description;
...
@@ -2,10 +2,12 @@ package com.github.fengyuchenglun.apidoc.core.common.description;
import
com.github.javaparser.resolution.types.ResolvedPrimitiveType
;
import
com.github.javaparser.resolution.types.ResolvedPrimitiveType
;
import
com.github.javaparser.resolution.types.ResolvedReferenceType
;
import
com.github.javaparser.resolution.types.ResolvedReferenceType
;
import
lombok.Data
;
/**
/**
* 原始类型描述
* 原始类型描述
*/
*/
@Data
public
class
PrimitiveTypeDescription
extends
TypeDescription
{
public
class
PrimitiveTypeDescription
extends
TypeDescription
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/StringTypeDescription.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.common.description
;
package
com.github.fengyuchenglun.apidoc.core.common.description
;
import
lombok.Data
;
/**
/**
* 字符串类型
* 字符串类型
*/
*/
@Data
public
class
StringTypeDescription
extends
TypeDescription
{
public
class
StringTypeDescription
extends
TypeDescription
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/TypeDescription.java
View file @
ec4188d8
...
@@ -6,6 +6,7 @@ import com.github.fengyuchenglun.apidoc.core.schema.Row;
...
@@ -6,6 +6,7 @@ import com.github.fengyuchenglun.apidoc.core.schema.Row;
import
com.github.javaparser.ast.comments.Comment
;
import
com.github.javaparser.ast.comments.Comment
;
import
com.github.javaparser.javadoc.Javadoc
;
import
com.github.javaparser.javadoc.Javadoc
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -13,9 +14,9 @@ import java.util.Collection;
...
@@ -13,9 +14,9 @@ import java.util.Collection;
/**
/**
* The type Type description.
* The type Type description.
* @author duanledexianxianxian
*/
*/
@Setter
@Data
@Getter
public
abstract
class
TypeDescription
{
public
abstract
class
TypeDescription
{
/**
/**
...
@@ -46,10 +47,11 @@ public abstract class TypeDescription {
...
@@ -46,10 +47,11 @@ public abstract class TypeDescription {
* 默认值.
* 默认值.
*/
*/
protected
Object
defaultValue
;
protected
Object
defaultValue
;
/**
/**
* 是否必填.
* 是否必填.
*/
*/
protected
Boolean
required
;
protected
Boolean
required
=
false
;
/**
/**
* Is available boolean.
* Is available boolean.
...
@@ -185,11 +187,11 @@ public abstract class TypeDescription {
...
@@ -185,11 +187,11 @@ public abstract class TypeDescription {
def
=
""
;
def
=
""
;
}
}
if
(
required
!=
null
)
{
//
if (required != null) {
condition
.
append
(
"required="
).
append
(
required
);
//
condition.append("required=").append(required);
}
//
}
return
Lists
.
newArrayList
(
new
Row
(
key
,
type
,
false
,
condition
.
toString
(),
def
,
remark
,
requestParameterType
));
return
Lists
.
newArrayList
(
new
Row
(
key
,
type
,
required
,
condition
.
toString
(),
def
,
remark
,
requestParameterType
));
}
}
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/common/description/UnAvailableTypeDescription.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.common.description
;
package
com.github.fengyuchenglun.apidoc.core.common.description
;
import
com.github.fengyuchenglun.apidoc.core.schema.Row
;
import
com.github.fengyuchenglun.apidoc.core.schema.Row
;
import
lombok.Data
;
import
java.util.Collection
;
import
java.util.Collection
;
/**
/**
* 未知类型,应该忽略
* 未知类型,应该忽略
* @author duanledexianxianxian
*/
*/
@Data
public
class
UnAvailableTypeDescription
extends
TypeDescription
{
public
class
UnAvailableTypeDescription
extends
TypeDescription
{
public
UnAvailableTypeDescription
()
{
public
UnAvailableTypeDescription
()
{
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/render/MarkdownRender.java
View file @
ec4188d8
...
@@ -43,6 +43,7 @@ public class MarkdownRender implements ProjectRender {
...
@@ -43,6 +43,7 @@ public class MarkdownRender implements ProjectRender {
}
}
private
void
build
(
Project
project
)
throws
Exception
{
private
void
build
(
Project
project
)
throws
Exception
{
System
.
out
.
println
(
project
);
String
templatePath
=
ApiDoc
.
getInstance
().
getContext
().
getMarkdownTemplate
();
String
templatePath
=
ApiDoc
.
getInstance
().
getContext
().
getMarkdownTemplate
();
String
id
=
ApiDoc
.
getInstance
().
getContext
().
getId
();
String
id
=
ApiDoc
.
getInstance
().
getContext
().
getId
();
Path
buildPath
=
ApiDoc
.
getInstance
().
getContext
().
getBuildPath
();
Path
buildPath
=
ApiDoc
.
getInstance
().
getContext
().
getBuildPath
();
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Appendix.java
View file @
ec4188d8
...
@@ -5,6 +5,8 @@ import com.github.javaparser.ast.comments.JavadocComment;
...
@@ -5,6 +5,8 @@ import com.github.javaparser.ast.comments.JavadocComment;
import
com.github.javaparser.ast.nodeTypes.NodeWithSimpleName
;
import
com.github.javaparser.ast.nodeTypes.NodeWithSimpleName
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.EnumHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.EnumHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.FieldHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.FieldHelper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -15,8 +17,8 @@ import java.util.List;
...
@@ -15,8 +17,8 @@ import java.util.List;
/**
/**
* 附录
* 附录
*/
*/
@
Setter
@
Data
@
Getter
@
EqualsAndHashCode
(
callSuper
=
true
)
public
class
Appendix
extends
Node
{
public
class
Appendix
extends
Node
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Book.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.schema
;
package
com.github.fengyuchenglun.apidoc.core.schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -12,8 +14,8 @@ import java.util.TreeSet;
...
@@ -12,8 +14,8 @@ import java.util.TreeSet;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@
Setter
@
Data
@
Getter
@
EqualsAndHashCode
(
callSuper
=
true
)
public
class
Book
extends
Node
{
public
class
Book
extends
Node
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Cell.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.schema
;
package
com.github.fengyuchenglun.apidoc.core.schema
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
...
@@ -9,6 +10,7 @@ import java.util.List;
...
@@ -9,6 +10,7 @@ import java.util.List;
*
*
* @param <T> the type parameter
* @param <T> the type parameter
*/
*/
@Data
public
class
Cell
<
T
>
{
public
class
Cell
<
T
>
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Chapter.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.schema
;
package
com.github.fengyuchenglun.apidoc.core.schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -12,15 +14,14 @@ import java.util.TreeSet;
...
@@ -12,15 +14,14 @@ import java.util.TreeSet;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@
Setter
@
Data
@
Getter
@
EqualsAndHashCode
(
callSuper
=
true
)
public
class
Chapter
extends
Node
{
public
class
Chapter
extends
Node
{
/**
/**
* The Book name.
* The Book name.
*/
*/
String
bookName
;
String
bookName
;
Project
project
;
/**
/**
* The Sections.
* The Sections.
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Header.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.schema
;
package
com.github.fengyuchenglun.apidoc.core.schema
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -10,8 +11,7 @@ import lombok.Setter;
...
@@ -10,8 +11,7 @@ import lombok.Setter;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@Setter
@Data
@Getter
@NoArgsConstructor
@NoArgsConstructor
public
class
Header
{
public
class
Header
{
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Node.java
View file @
ec4188d8
...
@@ -5,6 +5,8 @@ import com.github.javaparser.ast.comments.Comment;
...
@@ -5,6 +5,8 @@ import com.github.javaparser.ast.comments.Comment;
import
com.github.javaparser.javadoc.Javadoc
;
import
com.github.javaparser.javadoc.Javadoc
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.CommentHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.CommentHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -19,8 +21,7 @@ import java.util.Optional;
...
@@ -19,8 +21,7 @@ import java.util.Optional;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@Setter
@Data
@Getter
public
class
Node
implements
Comparable
<
Node
>
{
public
class
Node
implements
Comparable
<
Node
>
{
/**
/**
* 节点类型
* 节点类型
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Project.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.schema
;
package
com.github.fengyuchenglun.apidoc.core.schema
;
import
com.github.javaparser.ast.body.ClassOrInterfaceDeclaration
;
import
com.github.javaparser.ast.body.ClassOrInterfaceDeclaration
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -13,8 +15,8 @@ import java.util.*;
...
@@ -13,8 +15,8 @@ import java.util.*;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@
Setter
@
Data
@
Getter
@
EqualsAndHashCode
(
callSuper
=
true
)
public
class
Project
extends
Node
{
public
class
Project
extends
Node
{
/**
/**
...
@@ -42,7 +44,6 @@ public class Project extends Node {
...
@@ -42,7 +44,6 @@ public class Project extends Node {
* @param chapter the chapter
* @param chapter the chapter
*/
*/
public
void
addChapter
(
Chapter
chapter
)
{
public
void
addChapter
(
Chapter
chapter
)
{
chapter
.
setProject
(
this
);
if
(
Objects
.
isNull
(
chapter
.
getBookName
()))
{
if
(
Objects
.
isNull
(
chapter
.
getBookName
()))
{
chapter
.
setBookName
(
Book
.
DEFAULT
);
chapter
.
setBookName
(
Book
.
DEFAULT
);
}
}
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Row.java
View file @
ec4188d8
...
@@ -11,8 +11,7 @@ import lombok.*;
...
@@ -11,8 +11,7 @@ import lombok.*;
@EqualsAndHashCode
@EqualsAndHashCode
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@Setter
@Data
@Getter
public
class
Row
{
public
class
Row
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Section.java
View file @
ec4188d8
...
@@ -5,6 +5,8 @@ import com.github.fengyuchenglun.apidoc.core.common.QueryStringBuilder;
...
@@ -5,6 +5,8 @@ import com.github.fengyuchenglun.apidoc.core.common.QueryStringBuilder;
import
com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper
;
import
com.github.fengyuchenglun.apidoc.core.common.helper.StringHelper
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -17,8 +19,8 @@ import java.util.*;
...
@@ -17,8 +19,8 @@ import java.util.*;
* @author fengyuchenglun
* @author fengyuchenglun
* @version 1.0.0
* @version 1.0.0
*/
*/
@
Setter
@
Data
@
Getter
@
EqualsAndHashCode
(
callSuper
=
true
)
public
class
Section
extends
Node
{
public
class
Section
extends
Node
{
/**
/**
...
...
apidoc-core/src/main/java/com/github/fengyuchenglun/apidoc/core/schema/Tag.java
View file @
ec4188d8
package
com.github.fengyuchenglun.apidoc.core.schema
;
package
com.github.fengyuchenglun.apidoc.core.schema
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -14,8 +15,7 @@ import java.util.Objects;
...
@@ -14,8 +15,7 @@ import java.util.Objects;
* @version 1.0.0
* @version 1.0.0
*/
*/
@Slf4j
@Slf4j
@Setter
@Data
@Getter
public
class
Tag
{
public
class
Tag
{
/**
/**
...
...
apidoc-springmvc/src/main/java/com/github/fengyuchenglun/apidoc/springmvc/SpringParser.java
View file @
ec4188d8
...
@@ -265,6 +265,8 @@ public class SpringParser implements ParserStrategy {
...
@@ -265,6 +265,8 @@ public class SpringParser implements ParserStrategy {
Optional
<
AnnotationExpr
>
optional
=
parameter
.
getAnnotationByName
(
ParameterHelper
.
ANNOTATION_REQUEST_PARAM
);
Optional
<
AnnotationExpr
>
optional
=
parameter
.
getAnnotationByName
(
ParameterHelper
.
ANNOTATION_REQUEST_PARAM
);
if
(
optional
.
isPresent
())
{
if
(
optional
.
isPresent
())
{
// 如果有RequestParam注解,则参数必填
required
=
true
;
Optional
<
Expression
>
valueOptional
=
AnnotationHelper
.
getAnyAttribute
(
optional
.
get
(),
"value"
,
"name"
);
Optional
<
Expression
>
valueOptional
=
AnnotationHelper
.
getAnyAttribute
(
optional
.
get
(),
"value"
,
"name"
);
if
(
valueOptional
.
isPresent
())
{
if
(
valueOptional
.
isPresent
())
{
key
=
String
.
valueOf
(
ExpressionHelper
.
getValue
(
valueOptional
.
get
()));
key
=
String
.
valueOf
(
ExpressionHelper
.
getValue
(
valueOptional
.
get
()));
...
...
apidoc-springmvc/src/test/java/com/github/fengyuchenglun/example/spring/advanced/UserController.java
View file @
ec4188d8
...
@@ -3,6 +3,7 @@ package com.github.fengyuchenglun.example.spring.advanced;
...
@@ -3,6 +3,7 @@ package com.github.fengyuchenglun.example.spring.advanced;
import
com.github.fengyuchenglun.example.annotation.KimController
;
import
com.github.fengyuchenglun.example.annotation.KimController
;
import
com.github.fengyuchenglun.example.common.Query
;
import
com.github.fengyuchenglun.example.common.Query
;
import
com.github.fengyuchenglun.example.common.User
;
import
com.github.fengyuchenglun.example.common.User
;
import
com.github.fengyuchenglun.example.common.UserQuery
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -42,7 +43,7 @@ public class UserController {
...
@@ -42,7 +43,7 @@ public class UserController {
* @return 用户对象 user
* @return 用户对象 user
*/
*/
@GetMapping
(
value
=
"/detail1"
)
@GetMapping
(
value
=
"/detail1"
)
public
User
detail1
(
Query
query
)
{
public
User
detail1
(
Query
query
)
{
User
user
=
new
User
();
User
user
=
new
User
();
return
user
;
return
user
;
}
}
...
@@ -59,6 +60,65 @@ public class UserController {
...
@@ -59,6 +60,65 @@ public class UserController {
return
user
;
return
user
;
}
}
/**
* 查看用户详情
*
* @param query 过滤条件
* @return 用户对象 user
*/
@GetMapping
(
value
=
"/detail4"
)
public
User
detail4
(
@RequestParam
(
required
=
false
)
Query
query
)
{
User
user
=
new
User
();
return
user
;
}
/**
* 查看用户详情
*
* @return 用户对象 user
*/
@GetMapping
(
value
=
"/detail5"
)
public
User
detail5
()
{
User
user
=
new
User
();
return
user
;
}
/**
* 查看用户详情
*
* @param userName the user name
* @param age the age
* @param query the query
* @return 用户对象 user
*/
@GetMapping
(
value
=
"/detail6"
)
public
User
detail6
(
String
userName
,
Integer
age
,
UserQuery
query
)
{
User
user
=
new
User
();
return
user
;
}
/**
* 查看用户详情
*
* @return 用户对象 user
*/
@GetMapping
(
value
=
"/detail7"
)
public
void
detail7
()
{
}
/**
* 删除用户
*
* @param userId the user id
* @return boolean 是否成功
*/
@DeleteMapping
(
value
=
"/{userId}"
)
public
Boolean
deleteUser
(
@PathVariable
(
"userId"
)
Long
userId
)
{
return
true
;
}
/**
/**
* 用户表单对象.
* 用户表单对象.
*
*
...
@@ -86,7 +146,7 @@ public class UserController {
...
@@ -86,7 +146,7 @@ public class UserController {
* 添加用户
* 添加用户
*
*
* @param form 用户表单对象
* @param form 用户表单对象
* @return integer
integer
* @return integer
返回记录
*/
*/
@PostMapping
@PostMapping
public
Integer
add
(
@RequestBody
UserForm
form
)
{
public
Integer
add
(
@RequestBody
UserForm
form
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment