فهرست منبع

优化swagger注解

zhou-hao 4 سال پیش
والد
کامیت
6b8455e3a3

+ 8 - 7
hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/reactive/ReactiveQueryController.java

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
 import org.hswebframework.web.api.crud.entity.PagerResult;
+import org.hswebframework.web.api.crud.entity.QueryNoPagingOperation;
 import org.hswebframework.web.api.crud.entity.QueryOperation;
 import org.hswebframework.web.api.crud.entity.QueryParamEntity;
 import org.hswebframework.web.authorization.annotation.Authorize;
@@ -77,9 +78,9 @@ public interface ReactiveQueryController<E, K> {
      */
     @PostMapping("/_query/no-paging")
     @QueryAction
-    @Operation(summary = "使用POST方式分页动态查询(不返回总数)",
+    @QueryNoPagingOperation(summary = "使用POST方式分页动态查询(不返回总数)",
             description = "此操作不返回分页总数,如果需要获取全部数据,请设置参数paging=false")
-    default Flux<E> query(@RequestBody Mono<QueryParamEntity> query) {
+    default Flux<E> query(@Parameter(hidden = true) @RequestBody Mono<QueryParamEntity> query) {
         return query.flatMapMany(this::query);
     }
 
@@ -120,15 +121,15 @@ public interface ReactiveQueryController<E, K> {
     @PostMapping("/_query")
     @QueryAction
     @SuppressWarnings("all")
-    @Operation(summary = "使用POST方式分页动态查询")
-    default Mono<PagerResult<E>> queryPager(@RequestBody Mono<QueryParamEntity> query) {
+    @QueryOperation(summary = "使用POST方式分页动态查询")
+    default Mono<PagerResult<E>> queryPager(@Parameter(hidden = true) @RequestBody Mono<QueryParamEntity> query) {
         return query.flatMap(q -> queryPager(q));
     }
 
     @PostMapping("/_count")
     @QueryAction
-    @Operation(summary = "使用POST方式查询总数")
-    default Mono<Integer> count(@RequestBody Mono<QueryParamEntity> query) {
+    @QueryNoPagingOperation(summary = "使用POST方式查询总数")
+    default Mono<Integer> count(@Parameter(hidden = true) @RequestBody Mono<QueryParamEntity> query) {
         return query.flatMap(this::count);
     }
 
@@ -144,7 +145,7 @@ public interface ReactiveQueryController<E, K> {
      */
     @GetMapping("/_count")
     @QueryAction
-    @QueryOperation(summary = "使用GET方式查询总数")
+    @QueryNoPagingOperation(summary = "使用GET方式查询总数")
     default Mono<Integer> count(@Parameter(hidden = true) QueryParamEntity query) {
         return getRepository()
                 .createQuery()

+ 9 - 8
hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/reactive/ReactiveServiceQueryController.java

@@ -3,6 +3,7 @@ package org.hswebframework.web.crud.web.reactive;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import org.hswebframework.web.api.crud.entity.PagerResult;
+import org.hswebframework.web.api.crud.entity.QueryNoPagingOperation;
 import org.hswebframework.web.api.crud.entity.QueryOperation;
 import org.hswebframework.web.api.crud.entity.QueryParamEntity;
 import org.hswebframework.web.authorization.annotation.Authorize;
@@ -35,7 +36,7 @@ public interface ReactiveServiceQueryController<E, K> {
      */
     @GetMapping("/_query/no-paging")
     @QueryAction
-    @QueryOperation(summary = "使用GET方式分页动态查询(不返回总数)",
+    @QueryNoPagingOperation(summary = "使用GET方式分页动态查询(不返回总数)",
             description = "此操作不返回分页总数,如果需要获取全部数据,请设置参数paging=false")
     default Flux<E> query(@Parameter(hidden = true) QueryParamEntity query) {
         return getService()
@@ -71,9 +72,9 @@ public interface ReactiveServiceQueryController<E, K> {
      */
     @PostMapping("/_query/no-paging")
     @QueryAction
-    @Operation(summary = "使用POST方式分页动态查询(不返回总数)",
+    @QueryNoPagingOperation(summary = "使用POST方式分页动态查询(不返回总数)",
             description = "此操作不返回分页总数,如果需要获取全部数据,请设置参数paging=false")
-    default Flux<E> query(@RequestBody Mono<QueryParamEntity> query) {
+    default Flux<E> query(@Parameter(hidden = true)@RequestBody Mono<QueryParamEntity> query) {
         return query.flatMapMany(this::query);
     }
 
@@ -107,15 +108,15 @@ public interface ReactiveServiceQueryController<E, K> {
     @PostMapping("/_query")
     @QueryAction
     @SuppressWarnings("all")
-    @Operation(summary = "使用POST方式分页动态查询")
-    default Mono<PagerResult<E>> queryPager(@RequestBody Mono<QueryParamEntity> query) {
+    @QueryOperation(summary = "使用POST方式分页动态查询")
+    default Mono<PagerResult<E>> queryPager(@Parameter(hidden = true) @RequestBody Mono<QueryParamEntity> query) {
         return query.flatMap(q -> queryPager(q));
     }
 
     @PostMapping("/_count")
     @QueryAction
-    @Operation(summary = "使用POST方式查询总数")
-    default Mono<Integer> count(@RequestBody Mono<QueryParamEntity> query) {
+    @QueryNoPagingOperation(summary = "使用POST方式查询总数")
+    default Mono<Integer> count(@Parameter(hidden = true) @RequestBody Mono<QueryParamEntity> query) {
         return query.flatMap(this::count);
     }
 
@@ -131,7 +132,7 @@ public interface ReactiveServiceQueryController<E, K> {
      */
     @GetMapping("/_count")
     @QueryAction
-    @QueryOperation(summary = "使用GET方式查询总数")
+    @QueryNoPagingOperation(summary = "使用GET方式查询总数")
     default Mono<Integer> count(@Parameter(hidden = true) QueryParamEntity query) {
         return getService()
                 .createQuery()

+ 6 - 7
hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/reactive/ReactiveTreeServiceQueryController.java

@@ -1,6 +1,5 @@
 package org.hswebframework.web.crud.web.reactive;
 
-import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import org.hswebframework.web.api.crud.entity.QueryOperation;
 import org.hswebframework.web.api.crud.entity.QueryParamEntity;
@@ -43,22 +42,22 @@ public interface ReactiveTreeServiceQueryController<E extends TreeSortSupportEnt
 
     @PostMapping("/_query/tree")
     @QueryAction
-    @Operation(summary = "使用POST动态查询并返回树形结构")
-    default Mono<List<E>> findAllTree(Mono<QueryParamEntity> paramEntity) {
+    @QueryOperation(summary = "使用POST动态查询并返回树形结构")
+    default Mono<List<E>> findAllTree(@Parameter(hidden = true) Mono<QueryParamEntity> paramEntity) {
         return getService().queryResultToTree(paramEntity);
     }
 
     @PostMapping("/_query/_children")
     @QueryAction
-    @Operation(summary = "使用POST动态查询并返回子节点数据")
-    default Flux<E> findAllChildren(Mono<QueryParamEntity> paramEntity) {
+    @QueryOperation(summary = "使用POST动态查询并返回子节点数据")
+    default Flux<E> findAllChildren(@Parameter(hidden = true) Mono<QueryParamEntity> paramEntity) {
         return paramEntity.flatMapMany(param -> getService().queryIncludeChildren(param));
     }
 
     @PostMapping("/_query/_children/tree")
     @QueryAction
-    @Operation(summary = "使用POST动态查询并返回子节点树形结构数据")
-    default Mono<List<E>> findAllChildrenTree(Mono<QueryParamEntity> paramEntity) {
+    @QueryOperation(summary = "使用POST动态查询并返回子节点树形结构数据")
+    default Mono<List<E>> findAllChildrenTree(@Parameter(hidden = true) Mono<QueryParamEntity> paramEntity) {
         return paramEntity.flatMap(param -> getService().queryIncludeChildrenTree(param));
     }