Browse Source

增加swagger3文档说明

zhou-hao 4 năm trước cách đây
mục cha
commit
ea986ddb7e
29 tập tin đã thay đổi với 233 bổ sung67 xóa
  1. 9 2
      hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/AuthorizationController.java
  2. 25 23
      hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/ReactiveUserTokenController.java
  3. 5 0
      hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/GenericTreeSortSupportEntity.java
  4. 6 6
      hsweb-core/src/main/java/org/hswebframework/web/aop/MethodInterceptorHolder.java
  5. 2 1
      hsweb-logging/hsweb-access-logging-aop/src/main/java/org/hswebframework/web/logging/aop/Swagger3AccessLoggerParser.java
  6. 5 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/ActionEntity.java
  7. 11 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/AuthorizationSettingEntity.java
  8. 5 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DataAccessEntity.java
  9. 6 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java
  10. 3 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionTypeEntity.java
  11. 12 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionUserEntity.java
  12. 5 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/OptionalField.java
  13. 5 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/ParentPermission.java
  14. 8 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/PermissionEntity.java
  15. 10 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/UserEntity.java
  16. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/enums/DimensionUserFeature.java
  17. 3 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/DimensionTypeResponse.java
  18. 2 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxAuthorizationSettingController.java
  19. 2 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxDimensionController.java
  20. 5 0
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxDimensionTypeController.java
  21. 15 3
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxDimensionUserController.java
  22. 8 3
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxPermissionController.java
  23. 23 11
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxUserController.java
  24. 21 12
      hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/entity/DictionaryEntity.java
  25. 13 0
      hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/entity/DictionaryItemEntity.java
  26. 6 0
      hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/webflux/WebfluxDictionaryController.java
  27. 2 0
      hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/webflux/WebfluxDictionaryItemController.java
  28. 6 0
      hsweb-system/hsweb-system-file/pom.xml
  29. 9 2
      hsweb-system/hsweb-system-file/src/main/java/org/hswebframework/web/file/web/ReactiveFileController.java

+ 9 - 2
hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/AuthorizationController.java

@@ -19,6 +19,10 @@ package org.hswebframework.web.authorization.basic.web;
 
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.SneakyThrows;
 import org.hswebframework.web.authorization.Authentication;
 import org.hswebframework.web.authorization.ReactiveAuthenticationManager;
@@ -34,6 +38,7 @@ import org.hswebframework.web.authorization.simple.PlainTextUsernamePasswordAuth
 import org.hswebframework.web.logging.AccessLogger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
+import org.springframework.data.repository.query.Param;
 import org.springframework.http.MediaType;
 import org.springframework.util.Assert;
 import org.springframework.web.bind.annotation.*;
@@ -47,6 +52,7 @@ import java.util.function.Function;
  */
 @RestController
 @RequestMapping("${hsweb.web.mappings.authorize:authorize}")
+@Tag(name = "授权接口")
 public class AuthorizationController {
 
 
@@ -58,7 +64,7 @@ public class AuthorizationController {
 
     @GetMapping("/me")
     @Authorize
-    @ApiOperation("当前登录用户权限信息")
+    @Operation(summary = "当前登录用户权限信息")
     public Mono<Authentication> me() {
         return Authentication.currentReactive()
                 .switchIfEmpty(Mono.error(UnAuthorizedException::new));
@@ -68,7 +74,8 @@ public class AuthorizationController {
     @ApiOperation("用户名密码登录,json方式")
     @Authorize(ignore = true)
     @AccessLogger(ignore = true)
-    public Mono<Map<String, Object>> authorizeByJson(@ApiParam(example = "{\"username\":\"admin\",\"password\":\"admin\"}")
+    @Operation(summary = "登录",description = "必要参数:username,password.根据配置不同,其他参数也不同,如:验证码等.")
+    public Mono<Map<String, Object>> authorizeByJson(@Parameter(example = "{\"username\":\"admin\",\"password\":\"admin\"}")
                                                      @RequestBody Mono<Map<String, Object>> parameter) {
         return doLogin(parameter);
     }

+ 25 - 23
hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/ReactiveUserTokenController.java

@@ -1,6 +1,7 @@
 package org.hswebframework.web.authorization.basic.web;
 
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.authorization.Authentication;
 import org.hswebframework.web.authorization.ReactiveAuthenticationManager;
 import org.hswebframework.web.authorization.annotation.Authorize;
@@ -24,6 +25,7 @@ import reactor.core.publisher.Mono;
 @RequestMapping
 @Authorize
 @Resource(id = "user-token", name = "用户令牌信息管理")
+@Tag(name = "用户令牌管理")
 public class ReactiveUserTokenController {
     private UserTokenManager userTokenManager;
 
@@ -43,7 +45,7 @@ public class ReactiveUserTokenController {
 
     @GetMapping("/user-token/reset")
     @Authorize(merge = false)
-    @ApiOperation("重置当前用户的令牌")
+    @Operation(summary = "重置当前用户的令牌")
     public Mono<Boolean> resetToken() {
         return ContextUtils.reactiveContext()
                 .map(context -> context.get(ContextKey.of(ParsedToken.class)).orElseThrow(UnAuthorizedException::new))
@@ -52,7 +54,7 @@ public class ReactiveUserTokenController {
     }
 
     @PutMapping("/user-token/check")
-    @ApiOperation("检查所有已过期的token并移除")
+    @Operation(summary = "检查所有已过期的token并移除")
     @SaveAction
     public Mono<Boolean> checkExpiredToken() {
         return userTokenManager
@@ -61,63 +63,63 @@ public class ReactiveUserTokenController {
     }
 
     @GetMapping("/user-token/token/{token}")
-    @ApiOperation("根据token获取令牌信息")
+    @Operation(summary = "根据token获取令牌信息")
     @QueryAction
     public Mono<UserToken> getByToken(@PathVariable String token) {
         return userTokenManager.getByToken(token);
     }
 
     @GetMapping("/user-token/user/{userId}")
-    @ApiOperation("根据用户ID获取全部令牌信息")
+    @Operation(summary = "根据用户ID获取全部令牌信息")
     @QueryAction
     public Flux<UserToken> getByUserId(@PathVariable String userId) {
         return userTokenManager.getByUserId(userId);
     }
 
     @GetMapping("/user-token/user/{userId}/logged")
-    @ApiOperation("根据用户ID判断用户是否已经登录")
+    @Operation(summary = "根据用户ID判断用户是否已经登录")
     @QueryAction
     public Mono<Boolean> userIsLoggedIn(@PathVariable String userId) {
         return userTokenManager.userIsLoggedIn(userId);
     }
 
     @GetMapping("/user-token/token/{token}/logged")
-    @ApiOperation("根据令牌判断用户是否已经登录")
+    @Operation(summary = "根据令牌判断用户是否已经登录")
     @QueryAction
     public Mono<Boolean> tokenIsLoggedIn(@PathVariable String token) {
         return userTokenManager.tokenIsLoggedIn(token);
     }
 
     @GetMapping("/user-token/user/total")
-    @ApiOperation("获取当前已经登录的用户数量")
+    @Operation(summary = "获取当前已经登录的用户数量")
     @Authorize(merge = false)
     public Mono<Integer> totalUser() {
         return userTokenManager.totalUser();
     }
 
     @GetMapping("/user-token/token/total")
-    @ApiOperation("获取当前已经登录的令牌数量")
+    @Operation(summary = "获取当前已经登录的令牌数量")
     @Authorize(merge = false)
     public Mono<Integer> totalToken() {
         return userTokenManager.totalToken();
     }
 
     @GetMapping("/user-token")
-    @ApiOperation("获取全部用户令牌信息")
+    @Operation(summary = "获取全部用户令牌信息")
     @QueryAction
     public Flux<UserToken> allLoggedUser() {
         return userTokenManager.allLoggedUser();
     }
 
     @DeleteMapping("/user-token/user/{userId}")
-    @ApiOperation("根据用户id将用户踢下线")
+    @Operation(summary = "根据用户id将用户踢下线")
     @SaveAction
     public Mono<Void> signOutByUserId(@PathVariable String userId) {
         return userTokenManager.signOutByUserId(userId);
     }
 
     @DeleteMapping("/user-token/token/{token}")
-    @ApiOperation("根据令牌将用户踢下线")
+    @Operation(summary = "根据令牌将用户踢下线")
     @SaveAction
     public Mono<Void> signOutByToken(@PathVariable String token) {
         return userTokenManager.signOutByToken(token);
@@ -126,35 +128,35 @@ public class ReactiveUserTokenController {
 
     @SaveAction
     @PutMapping("/user-token/user/{userId}/{state}")
-    @ApiOperation("根据用户id更新用户令牌状态")
+    @Operation(summary = "根据用户id更新用户令牌状态")
     public Mono<Void> changeUserState(@PathVariable String userId, @PathVariable TokenState state) {
 
         return userTokenManager.changeUserState(userId, state);
     }
 
     @PutMapping("/user-token/token/{token}/{state}")
-    @ApiOperation("根据令牌更新用户令牌状态")
+    @Operation(summary = "根据令牌更新用户令牌状态")
     @SaveAction
     public Mono<Void> changeTokenState(@PathVariable String token, @PathVariable TokenState state) {
         return userTokenManager.changeTokenState(token, state);
     }
-
-    @PostMapping("/user-token/{token}/{type}/{userId}/{maxInactiveInterval}")
-    @ApiOperation("将用户设置为登录")
-    @SaveAction
-    public Mono<UserToken> signIn(@PathVariable String token, @PathVariable String type, @PathVariable String userId, @PathVariable long maxInactiveInterval) {
-        return userTokenManager.signIn(token, type, userId, maxInactiveInterval);
-    }
+//
+//    @PostMapping("/user-token/{token}/{type}/{userId}/{maxInactiveInterval}")
+//    @Operation(summary = "将用户设置为登录")
+//    @SaveAction
+//    public Mono<UserToken> signIn(@PathVariable String token, @PathVariable String type, @PathVariable String userId, @PathVariable long maxInactiveInterval) {
+//        return userTokenManager.signIn(token, type, userId, maxInactiveInterval);
+//    }
 
     @GetMapping("/user-token/{token}/touch")
-    @ApiOperation("更新token有效期")
+    @Operation(summary = "更新token有效期")
     @SaveAction
     public Mono<Void> touch(@PathVariable String token) {
         return userTokenManager.touch(token);
     }
 
     @GetMapping("/user-auth/{userId}")
-    @ApiOperation("根据用户id获取用户的权限信息")
+    @Operation(summary = "根据用户id获取权限信息")
     @SaveAction
     public Mono<Authentication> userAuthInfo(@PathVariable String userId) {
         return authenticationManager.getByUserId(userId);

+ 5 - 0
hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/GenericTreeSortSupportEntity.java

@@ -19,6 +19,7 @@
 package org.hswebframework.web.api.crud.entity;
 
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
@@ -37,6 +38,7 @@ public abstract class GenericTreeSortSupportEntity<PK> extends GenericEntity<PK>
      */
     @Column(name = "parent_id", length = 32)
     @Comment("父级ID")
+    @Schema(description = "父节点ID")
     private PK parentId;
 
     /**
@@ -45,6 +47,7 @@ public abstract class GenericTreeSortSupportEntity<PK> extends GenericEntity<PK>
      */
     @Column(name = "path", length = 128)
     @Comment("树路径")
+    @Schema(description = "树结构路径")
     private String path;
 
     /**
@@ -52,10 +55,12 @@ public abstract class GenericTreeSortSupportEntity<PK> extends GenericEntity<PK>
      */
     @Column(name = "sort_index", precision = 32)
     @Comment("排序序号")
+    @Schema(description = "排序序号")
     private Long sortIndex;
 
     @Column(name = "_level", precision = 32)
     @Comment("树层级")
+    @Schema(description = "树层级")
     private Integer level;
 
 

+ 6 - 6
hsweb-core/src/main/java/org/hswebframework/web/aop/MethodInterceptorHolder.java

@@ -66,17 +66,17 @@ public class MethodInterceptorHolder {
                 argMap);
     }
 
-    private String id;
+    private final String id;
 
-    private Method method;
+    private final Method method;
 
-    private Object target;
+    private final Object target;
 
-    private Object[] arguments;
+    private final Object[] arguments;
 
-    private String[] argumentsNames;
+    private final String[] argumentsNames;
 
-    private Map<String, Object> namedArguments;
+    private final Map<String, Object> namedArguments;
 
 
     public <T extends Annotation> T findMethodAnnotation(Class<T> annClass) {

+ 2 - 1
hsweb-logging/hsweb-access-logging-aop/src/main/java/org/hswebframework/web/logging/aop/Swagger3AccessLoggerParser.java

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.aop.MethodInterceptorHolder;
 import org.hswebframework.web.logging.LoggerDefine;
+import org.springframework.core.annotation.AnnotatedElementUtils;
 import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.util.StringUtils;
 
@@ -22,7 +23,7 @@ public class Swagger3AccessLoggerParser implements AccessLoggerParser {
     @Override
     public LoggerDefine parse(MethodInterceptorHolder holder) {
         Tag api = holder.findAnnotation(Tag.class);
-        Operation operation = holder.findAnnotation(Operation.class);
+        Operation operation = AnnotatedElementUtils.findMergedAnnotation(holder.getMethod(),Operation.class);
         String action = "";
         if (api != null) {
             action = action.concat(api.name());

+ 5 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/ActionEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import org.hswebframework.web.api.crud.entity.Entity;
 
@@ -13,11 +14,15 @@ import java.util.Map;
 @EqualsAndHashCode(of = "action")
 public class ActionEntity implements Entity {
 
+    @Schema(description = "操作标识,如: add,query")
     private String action;
 
+    @Schema(description = "名称")
     private String name;
 
+    @Schema(description = "说明")
     private String describe;
 
+    @Schema(description = "其他配置")
     private Map<String,Object> properties;
 }

+ 11 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/AuthorizationSettingEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
@@ -31,48 +32,58 @@ public class AuthorizationSettingEntity implements Entity {
     @Column(length = 32, nullable = false, updatable = false)
     @Comment("权限ID")
     @NotBlank(message = "权限ID不能为空",groups = CreateGroup.class)
+    @Schema(description = "权限ID")
     private String permission;
 
     @Column(name = "dimension_type",length = 32, nullable = false,updatable = false)
     @Comment("维度类型")//如:user,role
     @NotBlank(message = "维度不能为空",groups = CreateGroup.class)
+    @Schema(description = "维度类型,如: user,role")
     private String dimensionType;
 
     @Column(name = "dimension_type_name", length = 64)
     @Comment("维度类型名称")//如:用户,角色
+    @Schema(description = "维度类型名称,如: 用户,角色")
     private String dimensionTypeName;
 
     @Column(name = "dimension_target", length = 32, updatable = false)
     @Comment("维度目标")//具体的某个维度实例ID
     @NotBlank(message = "维度目标不能为空",groups = CreateGroup.class)
+    @Schema(description = "维度目标,如: 用户的ID,角色的ID")
     private String dimensionTarget;
 
     @Column(name = "dimension_target_name", length = 64)
     @Comment("维度目标名称")//维度实例名称.如: 用户名. 角色名
+    @Schema(description = "维度类型,如: 用户名,角色名")
     private String dimensionTargetName;
 
     @Column(name = "state", nullable = false)
     @Comment("状态")
     @NotNull(message = "状态不能为空",groups = CreateGroup.class)
+    @Schema(description = "状态,0禁用,1启用")
     private Byte state;
 
     @Column
     @ColumnType(jdbcType = JDBCType.CLOB)
     @JsonCodec
     @Comment("可操作权限")
+    @Schema(description = "授权可对此权限进行的操作")
     private Set<String> actions;
 
     @Column(name = "data_accesses")
     @ColumnType(jdbcType = JDBCType.CLOB)
     @JsonCodec
     @Comment("数据权限")
+    @Schema(description = "数据权限配置")
     private List<DataAccessEntity> dataAccesses;
 
     @Column
     @Comment("优先级")
+    @Schema(description = "冲突时,合并优先级")
     private Integer priority;
 
     @Column
     @Comment("是否合并")
+    @Schema(description = "冲突时,是否合并")
     private Boolean merge;
 }

+ 5 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DataAccessEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -11,12 +12,16 @@ import java.util.Set;
 @Setter
 public class DataAccessEntity {
 
+    @Schema(description = "操作标识")
     private String action;
 
+    @Schema(description = "数据权限类型")
     private String type;
 
+    @Schema(description = "说明")
     private String describe;
 
+    @Schema(description = "配置")
     private Map<String,Object> config;
 
     public Map<String,Object> toMap(){

+ 6 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
@@ -23,21 +24,26 @@ public class DimensionEntity extends GenericTreeSortSupportEntity<String> {
 
     @Comment("维度类型ID")
     @Column(length = 32,name = "type_id")
+    @Schema(description = "维度类型ID")
     private String typeId;
 
     @Comment("维度名称")
     @Column(length = 32)
+    @Schema(description = "维度名称")
     private String name;
 
     @Comment("描述")
     @Column(length = 256)
+    @Schema(description = "说明")
     private String describe;
 
     @Column
     @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     @Comment("其他配置")
     @JsonCodec
+    @Schema(description = "其他配置")
     private Map<String,Object> properties;
 
+    @Schema(description = "子节点")
     private List<DimensionEntity> children;
 }

+ 3 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionTypeEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
@@ -20,10 +21,12 @@ public class DimensionTypeEntity extends GenericEntity<String> implements Dimens
     @Comment("维度类型名称")
     @Column(length = 32, nullable = false)
     @NotBlank(message = "名称不能为空", groups = CreateGroup.class)
+    @Schema(description = "类型名称")
     private String name;
 
     @Comment("维度类型描述")
     @Column(length = 256)
+    @Schema(description = "说明")
     private String describe;
 
 }

+ 12 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/DimensionUserEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
@@ -12,6 +13,7 @@ import org.hswebframework.web.system.authorization.api.enums.DimensionUserFeatur
 import javax.persistence.Column;
 import javax.persistence.Index;
 import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
 import java.sql.JDBCType;
 
 @Getter
@@ -26,35 +28,44 @@ public class DimensionUserEntity extends GenericEntity<String> {
 
     @Comment("维度类型ID")
     @Column(name = "dimension_type_id", nullable = false, length = 32)
+    @Schema(description = "维度类型ID,如: org,tenant")
     private String dimensionTypeId;
 
     @Comment("维度ID")
     @Column(name = "dimension_id", nullable = false, length = 32)
+    @Schema(description = "维度ID")
     private String dimensionId;
 
     @Comment("维度名称")
     @Column(name = "dimension_name", nullable = false)
+    @NotBlank(message = "[dimensionName]不能为空")
+    @Schema(description = "维度名称")
     private String dimensionName;
 
     @Comment("用户ID")
     @Column(name = "user_id", nullable = false, length = 32)
+    @Schema(description = "用户ID")
     private String userId;
 
-    @Comment("用户ID")
+    @Comment("用户")
     @Column(name = "user_name", nullable = false)
+    @Schema(description = "用户名")
     private String userName;
 
     @Comment("关系")
     @Column(length = 32)
+    @Schema(description = "维度关系")
     private String relation;
 
     @Column(name = "relation_name")
     @Comment("关系名称")
+    @Schema(description = "维度关系名称")
     private String relationName;
 
     @Column(name = "features")
     @ColumnType(jdbcType = JDBCType.NUMERIC, javaType = Long.class)
     @EnumCodec(toMask = true)
+    @Schema(description = "其他功能")
     private DimensionUserFeature[] features;
 
     public boolean hasFeature(DimensionUserFeature feature) {

+ 5 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/OptionalField.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
@@ -11,9 +12,13 @@ import java.util.Map;
 @Data
 @EqualsAndHashCode(of = "name")
 public class OptionalField implements Entity {
+
+    @Schema(description = "字段名")
     private String name;
 
+    @Schema(description = "说明")
     private String describe;
 
+    @Schema(description = "其他配置")
     private Map<String, Object> properties;
 }

+ 5 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/ParentPermission.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import org.hswebframework.web.api.crud.entity.Entity;
 
@@ -11,12 +12,16 @@ public class ParentPermission implements Entity {
 
     private static final long serialVersionUID = -7099575758680437572L;
 
+    @Schema(description = "关联限标识")
     private String permission;
 
+    @Schema(description = "前置操作")
     private Set<String> preActions;
 
+    @Schema(description = "关联操作")
     private Set<String> actions;
 
+    @Schema(description = "其他配置")
     private Map<String, Object> properties;
 
 }

+ 8 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/PermissionEntity.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
 import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
@@ -23,38 +24,45 @@ public class PermissionEntity extends GenericEntity<String> {
 
     @Column
     @Comment("权限名称")
+    @Schema(description = "权限名称")
     private String name;
 
     @Column
     @Comment("说明")
+    @Schema(description = "说明")
     private String describe;
 
     @Column(nullable = false)
     @Comment("状态")
+    @Schema(description = "状态")
     private Byte status;
 
     @Column
     @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     @JsonCodec
     @Comment("可选操作")
+    @Schema(description = "可选操作")
     private List<ActionEntity> actions;
 
     @Column(name = "optional_fields")
     @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     @JsonCodec
     @Comment("可操作的字段")
+    @Schema(description = "可操作字段")
     private List<OptionalField> optionalFields;
 
     @Column
     @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     @JsonCodec
     @Comment("关联权限")
+    @Schema(description = "关联权限")
     private List<ParentPermission> parents;
 
     @Column
     @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
     @JsonCodec
     @Comment("其他配置")
+    @Schema(description = "其他配置")
     private Map<String, Object> properties;
 
 }

+ 10 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/entity/UserEntity.java

@@ -1,6 +1,8 @@
 package org.hswebframework.web.system.authorization.api.entity;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.Hidden;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
@@ -24,35 +26,43 @@ public class UserEntity extends GenericEntity<String> implements RecordCreationE
 
     @Column(length = 128, nullable = false)
     @NotBlank(message = "姓名不能为空", groups = CreateGroup.class)
+    @Schema(description = "姓名")
     private String name;
 
     @Column(length = 128, nullable = false, updatable = false)
     @NotBlank(message = "用户名不能为空", groups = CreateGroup.class)
+    @Schema(description = "用户名")
     private String username;
 
     @Column(nullable = false)
     @ToString.Ignore(cover = false)
     @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
     @NotBlank(message = "密码不能为空", groups = CreateGroup.class)
+    @Schema(description = "密码")
     private String password;
 
     @Column(nullable = false)
     @ToString.Ignore(cover = false)
     @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+    @Hidden
     private String salt;
 
     @Column
+    @Schema(description = "用户类型")
     private String type;
 
     @Column
     @DefaultValue("1")
+    @Schema(description = "用户状态")
     private Byte status;
 
     @Column(name = "creator_id", updatable = false)
+    @Hidden
     private String creatorId;
 
     @Column(name = "create_time", updatable = false)
     @DefaultValue(generator = "current_time")
+    @Hidden
     private Long createTime;
 
     @Override

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/src/main/java/org/hswebframework/web/system/authorization/api/enums/DimensionUserFeature.java

@@ -10,7 +10,7 @@ public enum DimensionUserFeature implements EnumDict<String> {
     mergeChildrenPermission("合并子级维度权限")
     ;
 
-    private String text;
+    private final String text;
 
     @Override
     public String getValue() {

+ 3 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/DimensionTypeResponse.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -12,8 +13,10 @@ import org.hswebframework.web.authorization.DimensionType;
 @NoArgsConstructor
 public class DimensionTypeResponse {
 
+    @Schema(description = "类型ID")
     private String id;
 
+    @Schema(description = "类型名称")
     private String name;
 
     public static DimensionTypeResponse of(DimensionType type) {

+ 2 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxAuthorizationSettingController.java

@@ -1,11 +1,10 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
 
-import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.Resource;
 import org.hswebframework.web.crud.service.ReactiveCrudService;
-import org.hswebframework.web.crud.web.reactive.ReactiveCrudController;
 import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
 import org.hswebframework.web.system.authorization.api.entity.AuthorizationSettingEntity;
 import org.hswebframework.web.system.authorization.defaults.service.DefaultAuthorizationSettingService;
@@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/autz-setting")
 @Authorize
 @Resource(id = "autz-setting",name = "权限分配",group = "system")
+@Tag(name = "权限分配")
 public class WebFluxAuthorizationSettingController implements ReactiveServiceCrudController<AuthorizationSettingEntity, String> {
 
     @Autowired

+ 2 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxDimensionController.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.Resource;
 import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/dimension")
 @Authorize
 @Resource(id = "dimension", name = "权限维度管理", group = "system")
+@Tag(name = "权限维度管理")
 public class WebFluxDimensionController implements ReactiveServiceCrudController<DimensionEntity, String>
         , ReactiveTreeServiceQueryController<DimensionEntity, String> {
 

+ 5 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxDimensionTypeController.java

@@ -1,5 +1,8 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
 import org.hswebframework.web.api.crud.entity.QueryParamEntity;
 import org.hswebframework.web.authorization.DimensionProvider;
@@ -25,6 +28,7 @@ import java.util.List;
 @RequestMapping("/dimension-type")
 @Authorize
 @Resource(id = "dimension", name = "权限维度管理", group = "system")
+@Tag(name = "权限维度类型管理")
 public class WebFluxDimensionTypeController implements ReactiveCrudController<DimensionTypeEntity, String> {
 
     @Autowired
@@ -35,6 +39,7 @@ public class WebFluxDimensionTypeController implements ReactiveCrudController<Di
 
     @GetMapping("/all")
     @QueryAction
+    @Operation(summary = "获取全部维度类型")
     public Flux<DimensionTypeResponse> findAllType() {
         return Flux.fromIterable(dimensionProviders)
                 .flatMap(DimensionProvider::getAllType)

+ 15 - 3
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxDimensionUserController.java

@@ -1,5 +1,8 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.DeleteAction;
 import org.hswebframework.web.authorization.annotation.Resource;
@@ -18,6 +21,7 @@ import reactor.core.publisher.Mono;
 @RequestMapping("/dimension-user")
 @Authorize
 @Resource(id = "dimension", name = "权限维度管理", group = "system")
+@Tag(name = "权限维度用户关联管理")
 public class WebFluxDimensionUserController implements ReactiveServiceCrudController<DimensionUserEntity, String> {
 
     @Autowired
@@ -31,7 +35,11 @@ public class WebFluxDimensionUserController implements ReactiveServiceCrudContro
 
     @DeleteAction
     @DeleteMapping("/user/{userId}/dimension/{dimensionId}")
-    public Mono<Integer> deleteByUserAndDimensionId(@PathVariable String userId, @PathVariable String dimensionId) {
+    @Operation(summary = "解除用户关联的指定维度")
+    public Mono<Integer> deleteByUserAndDimensionId(@PathVariable
+                                                    @Parameter(description = "用户ID") String userId,
+                                                    @PathVariable
+                                                    @Parameter(description = "维度ID") String dimensionId) {
         return dimensionUserService
                 .createDelete()
                 .where(DimensionUserEntity::getUserId, userId)
@@ -41,7 +49,9 @@ public class WebFluxDimensionUserController implements ReactiveServiceCrudContro
 
     @DeleteAction
     @DeleteMapping("/user/{userId}")
-    public Mono<Integer> deleteByUserId(@PathVariable String userId) {
+    @Operation(summary = "解除用户关联的全部维度")
+    public Mono<Integer> deleteByUserId(@PathVariable
+                                        @Parameter(description = "用户ID") String userId) {
         return dimensionUserService
                 .createDelete()
                 .where(DimensionUserEntity::getUserId, userId)
@@ -50,7 +60,9 @@ public class WebFluxDimensionUserController implements ReactiveServiceCrudContro
 
     @DeleteAction
     @DeleteMapping("/dimension/{dimensionId}")
-    public Mono<Integer> deleteByDimension(@PathVariable String dimensionId) {
+    @Operation(summary = "解除全部用户关联的指定维度")
+    public Mono<Integer> deleteByDimension(@PathVariable
+                                           @Parameter(description = "维度ID") String dimensionId) {
         return dimensionUserService
                 .createDelete()
                 .where(DimensionUserEntity::getDimensionId, dimensionId)

+ 8 - 3
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxPermissionController.java

@@ -1,5 +1,8 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.apache.commons.collections.CollectionUtils;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.QueryAction;
@@ -17,8 +20,9 @@ import java.util.List;
 @RestController
 @RequestMapping("/permission")
 @Authorize
-@Resource(id = "permission",name = "权限管理",group = "system")
-public class WebFluxPermissionController implements ReactiveServiceCrudController<PermissionEntity,String> {
+@Resource(id = "permission", name = "权限管理", group = "system")
+@Tag(name = "权限管理")
+public class WebFluxPermissionController implements ReactiveServiceCrudController<PermissionEntity, String> {
 
     @Autowired
     private DefaultPermissionService permissionService;
@@ -30,7 +34,8 @@ public class WebFluxPermissionController implements ReactiveServiceCrudControlle
 
     @PutMapping("/status/{status}")
     @QueryAction
-    public Mono<Integer> changePermissionState(@PathVariable Byte status, @RequestBody List<String> idList) {
+    @Operation(summary = "批量修改权限状态")
+    public Mono<Integer> changePermissionState(@PathVariable @Parameter(description = "状态值:0禁用,1启用.") Byte status, @RequestBody List<String> idList) {
 
         return Mono.just(idList)
                 .filter(CollectionUtils::isNotEmpty)

+ 23 - 11
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/webflux/WebFluxUserController.java

@@ -1,5 +1,8 @@
 package org.hswebframework.web.system.authorization.defaults.webflux;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.Getter;
 import lombok.Setter;
 import org.hswebframework.web.authorization.Authentication;
@@ -20,6 +23,7 @@ import reactor.core.publisher.Mono;
 @RequestMapping("/user")
 @Authorize
 @Resource(id = "user", name = "系统用户", group = "system")
+@Tag(name = "用户管理")
 public class WebFluxUserController implements ReactiveServiceQueryController<UserEntity, String> {
 
     @Autowired
@@ -27,6 +31,7 @@ public class WebFluxUserController implements ReactiveServiceQueryController<Use
 
     @PatchMapping
     @SaveAction
+    @Operation(summary = "保存用户信息")
     public Mono<Boolean> saveUser(@RequestBody Mono<UserEntity> user) {
         return Authentication
                 .currentReactive()
@@ -39,20 +44,37 @@ public class WebFluxUserController implements ReactiveServiceQueryController<Use
                 .as(reactiveUserService::saveUser);
     }
 
+
+    @PutMapping("/me")
+    @Authorize(merge = false)
+    @Operation(summary = "修改当前用户信息")
+    public Mono<Boolean> updateLoginUserInfo(@RequestBody UserEntity request) {
+        return Authentication
+                .currentReactive()
+                .switchIfEmpty(Mono.error(UnAuthorizedException::new))
+                .map(Authentication::getUser)
+                .map(User::getId)
+                .flatMap(userId -> reactiveUserService.updateById(userId, Mono.just(request)).map(integer -> integer > 0));
+    }
+
     @PutMapping("/{id:.+}/{state}")
     @SaveAction
-    public Mono<Integer> changeState(@PathVariable String id, @PathVariable Byte state) {
+    @Operation(summary = "修改用户状态")
+    public Mono<Integer> changeState(@PathVariable @Parameter(description = "用户ID") String id,
+                                     @PathVariable @Parameter(description = "状态,0禁用,1启用") Byte state) {
         return reactiveUserService.changeState(Mono.just(id), state);
     }
 
     @DeleteMapping("/{id:.+}")
     @DeleteAction
+    @Operation(summary = "删除用户")
     public Mono<Boolean> deleteUser(@PathVariable String id) {
         return reactiveUserService.deleteUser(id);
     }
 
     @PutMapping("/passwd")
     @Authorize(merge = false)
+    @Operation(summary = "修改当前用户密码")
     public Mono<Boolean> changePassword(@RequestBody ChangePasswordRequest request) {
         return Authentication
                 .currentReactive()
@@ -62,16 +84,6 @@ public class WebFluxUserController implements ReactiveServiceQueryController<Use
                 .flatMap(userId -> reactiveUserService.changePassword(userId, request.getOldPassword(), request.getNewPassword()));
     }
 
-    @PutMapping("/me")
-    @Authorize(merge = false)
-    public Mono<Boolean> updateLoginUserInfo(@RequestBody UserEntity request) {
-        return Authentication
-                .currentReactive()
-                .switchIfEmpty(Mono.error(UnAuthorizedException::new))
-                .map(Authentication::getUser)
-                .map(User::getId)
-                .flatMap(userId -> reactiveUserService.updateById(userId, Mono.just(request)).map(integer -> integer > 0));
-    }
 
     @Override
     public DefaultReactiveUserService getService() {

+ 21 - 12
hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/entity/DictionaryEntity.java

@@ -1,24 +1,26 @@
 /*
  *  Copyright 2019 http://www.hswebframework.org
- *  
+ *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  *  You may obtain a copy of the License at
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- *  
+ *
  */
 package org.hswebframework.web.dictionary.entity;
 
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
 import org.hswebframework.web.api.crud.entity.GenericEntity;
 import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
 import org.hswebframework.web.dict.DictDefine;
@@ -41,29 +43,36 @@ public class DictionaryEntity extends GenericEntity<String> implements RecordCre
     //字典名称
     @Column(nullable = false)
     @NotBlank(message = "名称不能为空")
-    private String                     name;
+    @Schema(description = "字典名称")
+    private String name;
     //分类
-    @Column(length = 32,name = "classified")
-    private String                     classified;
+    @Column(length = 32, name = "classified")
+    @Schema(description = "分类标识")
+    private String classified;
     //说明
     @Column
-    private String                     describe;
+    @Schema(description = "说明")
+    private String describe;
     //创建时间
     @Column(name = "create_time")
-    private Long                       createTime;
+    @Schema(description = "创建时间")
+    private Long createTime;
     //创建人id
     @Column(name = "creator_id")
-    private String                     creatorId;
+    @Schema(description = "创建人ID")
+    private String creatorId;
     //状态
     @Column(name = "status")
-    private Byte                       status;
+    @DefaultValue("1")
+    @Schema(description = "状态,0禁用,1启用")
+    private Byte status;
 
     //字段选项
     private List<DictionaryItemEntity> items;
 
 
-    public DictDefine toDictDefine(){
-       return DefaultDictDefine
+    public DictDefine toDictDefine() {
+        return DefaultDictDefine
                 .builder()
                 .id(this.getId())
                 .alias(this.getName())

+ 13 - 0
hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/entity/DictionaryItemEntity.java

@@ -17,8 +17,10 @@
 package org.hswebframework.web.dictionary.entity;
 
 import com.alibaba.fastjson.JSONObject;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Getter;
 import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
 import org.hswebframework.web.api.crud.entity.GenericTreeSortSupportEntity;
 import org.hswebframework.web.dict.EnumDict;
 
@@ -40,31 +42,41 @@ import java.util.List;
 public class DictionaryItemEntity extends GenericTreeSortSupportEntity<String> implements EnumDict<String> {
     //字典id
     @Column(name = "dict_id", length = 32, updatable = false, nullable = false)
+    @Schema(description = "数据字典ID")
     private String dictId;
     //名称
     @Column
+    @Schema(description = "选项名称")
     private String name;
     //字典值
     @Column
+    @Schema(description = "值")
     private String value;
     //字典文本
     @Column
+    @Schema(description = "文本内容")
     private String text;
     //字典值类型
     @Column(name = "value_type")
+    @Schema(description = "值类型")
     private String valueType;
     //是否启用
     @Column
+    @Schema(description = "状态,0禁用,1启用")
+    @DefaultValue("1")
     private Byte status;
     //说明
     @Column
+    @Schema(description = "说明")
     private String describe;
 
     //快速搜索码
     @Column(name = "search_code")
+    @Schema(description = "检索码")
     private String searchCode;
 
     @Column(name = "ordinal", nullable = false, updatable = false)
+    @Schema(description = "序列号,同一个字典中的选项不能重复,且不能修改.")
     private Integer ordinal;
 
     @Override
@@ -72,6 +84,7 @@ public class DictionaryItemEntity extends GenericTreeSortSupportEntity<String> i
         return ordinal == null ? 0 : ordinal;
     }
 
+    @Schema(description = "子节点")
     private List<DictionaryItemEntity> children;
 
     @Override

+ 6 - 0
hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/webflux/WebfluxDictionaryController.java

@@ -1,5 +1,8 @@
 package org.hswebframework.web.dictionary.webflux;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.authorization.annotation.Authorize;
 import org.hswebframework.web.authorization.annotation.Resource;
 import org.hswebframework.web.crud.service.ReactiveCrudService;
@@ -20,6 +23,7 @@ import reactor.core.publisher.Flux;
 @RestController
 @RequestMapping("/dictionary")
 @Resource(id = "dictionary", name = "数据字典")
+@Tag(name = "数据字典管理")
 public class WebfluxDictionaryController implements ReactiveServiceCrudController<DictionaryEntity, String> {
 
     @Autowired
@@ -35,6 +39,7 @@ public class WebfluxDictionaryController implements ReactiveServiceCrudControlle
 
     @GetMapping("/{id:.+}/items")
     @Authorize(merge = false)
+    @Operation(summary = "获取数据字段的所有选项")
     public Flux<EnumDict<?>> getItemDefineById(@PathVariable String id) {
         return repository.getDefine(id)
                 .flatMapIterable(DictDefine::getItems);
@@ -42,6 +47,7 @@ public class WebfluxDictionaryController implements ReactiveServiceCrudControlle
 
     @GetMapping("/_all")
     @Authorize(merge = false)
+    @Schema(description = "获取全部数据字典")
     public Flux<DictDefine> getAllDict() {
         return repository.getAllDefine();
     }

+ 2 - 0
hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/webflux/WebfluxDictionaryItemController.java

@@ -1,5 +1,6 @@
 package org.hswebframework.web.dictionary.webflux;
 
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.hswebframework.web.authorization.annotation.Resource;
 import org.hswebframework.web.crud.service.ReactiveCrudService;
 import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/dictionary-item")
 @Resource(id = "dictionary", name = "数据字典")
+@Tag(name = "数据字典选项管理")
 public class WebfluxDictionaryItemController implements ReactiveServiceCrudController<DictionaryItemEntity, String> {
 
     @Autowired

+ 6 - 0
hsweb-system/hsweb-system-file/pom.xml

@@ -28,6 +28,12 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-autoconfigure</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>io.swagger.core.v3</groupId>
+            <artifactId>swagger-annotations</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-webflux</artifactId>

+ 9 - 2
hsweb-system/hsweb-system-file/src/main/java/org/hswebframework/web/file/web/ReactiveFileController.java

@@ -1,5 +1,9 @@
 package org.hswebframework.web.file.web;
 
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterStyle;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.hswebframework.web.authorization.annotation.Resource;
@@ -21,15 +25,18 @@ import java.io.File;
 @Resource(id = "file", name = "文件上传")
 @Slf4j
 @RequestMapping("/file")
+@Tag(name = "文件上传")
 public class ReactiveFileController {
 
     @Autowired
     private FileUploadProperties properties;
 
-    @ResourceAction(id = "upload-static", name = "静态文件")
     @PostMapping("/static")
     @SneakyThrows
-    public Mono<String> uploadStatic(@RequestPart("file") Part part) {
+    @ResourceAction(id = "upload-static", name = "静态文件")
+    @Operation(summary = "上传静态文件")
+    public Mono<String> uploadStatic(@RequestPart("file")
+                                     @Parameter(name = "file", description = "文件", style = ParameterStyle.FORM) Part part) {
         FileUploadProperties.StaticFileInfo name;
         if (part instanceof FilePart) {
             FilePart filePart = ((FilePart) part);