Skip to content

Commit

Permalink
feature: 基础 dto 增加 swagger 文档描述信息
Browse files Browse the repository at this point in the history
  • Loading branch information
myoss committed Jul 21, 2020
1 parent da7c834 commit f02e54a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions myoss-starter-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
<artifactId>commons-text</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version>
<optional>true</optional>
</dependency>
<!-- utils end -->
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,33 @@
* @since 2018年5月9日 下午4:33:50
*/
@Data
@io.swagger.annotations.ApiModel("封装字典选项值")
public class DictItem<T extends Serializable> implements Serializable {
private static final long serialVersionUID = -4979428360062313584L;
/**
* 值
*/
@io.swagger.annotations.ApiModelProperty("值")
private T value;
/**
* 代码
*/
@io.swagger.annotations.ApiModelProperty("代码")
private String code;
/**
* 名称
*/
@io.swagger.annotations.ApiModelProperty("名称")
private String name;
/**
* 描述信息
*/
@io.swagger.annotations.ApiModelProperty("描述信息")
private String desc;
/**
* 扩展信息
*/
@io.swagger.annotations.ApiModelProperty("扩展信息")
private Map<String, Object> extraInfo;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@Accessors(chain = true)
@Data
@EqualsAndHashCode
@io.swagger.annotations.ApiModel("封装分页查询参数")
public class Page<T> implements Serializable {
/**
* 默认的每页条数为:20
Expand All @@ -51,30 +52,40 @@ public class Page<T> implements Serializable {
/**
* 每页条数
*/
@io.swagger.annotations.ApiModelProperty("每页条数")
private int pageSize = DEFAULT_PAGE_SIZE;
/**
* 第几页,在MySQL中是从0开始,使用的时候需要减一
*/
@io.swagger.annotations.ApiModelProperty("第几页,在MySQL中是从0开始,使用的时候需要减一")
private int pageNum = DEFAULT_PAGE_NUM;
/**
* 记录总数
*/
@io.swagger.annotations.ApiModelProperty("记录总数")
private int totalCount = 0;
/**
* 分页查询条件参数
*/
@io.swagger.annotations.ApiModelProperty(value = "分页查询条件参数", notes = "泛型")
private T param;
/**
* 分页排序字段
*/
@io.swagger.annotations.ApiModelProperty("分页排序字段")
private Sort sort;
/**
* 结果列表数据
*/
@io.swagger.annotations.ApiModelProperty(value = "结果列表数据", notes = "泛型")
private List<T> value;
@io.swagger.annotations.ApiModelProperty("是否成功")
private boolean success = true;
@io.swagger.annotations.ApiModelProperty("扩展信息")
private String errorMsg;
@io.swagger.annotations.ApiModelProperty("错误代码")
private String errorCode;
@io.swagger.annotations.ApiModelProperty("扩展信息")
private Map<String, Object> extraInfo;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@
@Accessors(chain = true)
@Data
@EqualsAndHashCode
@io.swagger.annotations.ApiModel("封装方法返回参数")
public class Result<T> implements Serializable {
private static final long serialVersionUID = -8699167988071027834L;
@io.swagger.annotations.ApiModelProperty(value = "结果值", notes = "泛型")
private T value;
@io.swagger.annotations.ApiModelProperty("是否成功")
private boolean success = true;
@io.swagger.annotations.ApiModelProperty("错误代码")
private String errorCode;
@io.swagger.annotations.ApiModelProperty("错误信息")
private String errorMsg;
@io.swagger.annotations.ApiModelProperty("扩展信息")
private Map<String, Object> extraInfo;

/**
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<!-- myoss cloud -->
<revision>2.1.11-RC1</revision>
<myoss-starter-projects.version>${revision}</myoss-starter-projects.version>
<swagger.version>1.6.2</swagger.version>
<!-- myoss cloud -->
</properties>
</project>

0 comments on commit f02e54a

Please sign in to comment.