mirror of
				https://github.com/continew-org/continew-starter.git
				synced 2025-10-30 23:00:11 +08:00 
			
		
		
		
	refactor: 移除全局响应拦截处理
This commit is contained in:
		| @@ -1,32 +0,0 @@ | |||||||
| /* |  | ||||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. |  | ||||||
|  * <p> |  | ||||||
|  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; |  | ||||||
|  * you may not use this file except in compliance with the License. |  | ||||||
|  * You may obtain a copy of the License at |  | ||||||
|  * <p> |  | ||||||
|  * http://www.gnu.org/licenses/lgpl.html |  | ||||||
|  * <p> |  | ||||||
|  * 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 top.charles7c.continew.starter.extension.crud.annotation; |  | ||||||
|  |  | ||||||
| import java.lang.annotation.ElementType; |  | ||||||
| import java.lang.annotation.Retention; |  | ||||||
| import java.lang.annotation.RetentionPolicy; |  | ||||||
| import java.lang.annotation.Target; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * 响应拦截忽略注解 |  | ||||||
|  * |  | ||||||
|  * @author BULL_BCLS |  | ||||||
|  * @since 1.0.0 |  | ||||||
|  */ |  | ||||||
| @Target({ElementType.METHOD}) |  | ||||||
| @Retention(RetentionPolicy.RUNTIME) |  | ||||||
| public @interface NoResponseAdvice {} |  | ||||||
| @@ -29,7 +29,6 @@ import org.springframework.validation.annotation.Validated; | |||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import top.charles7c.continew.starter.core.constant.StringConstants; | import top.charles7c.continew.starter.core.constant.StringConstants; | ||||||
| import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; | import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; | ||||||
| import top.charles7c.continew.starter.extension.crud.annotation.NoResponseAdvice; |  | ||||||
| import top.charles7c.continew.starter.extension.crud.enums.Api; | import top.charles7c.continew.starter.extension.crud.enums.Api; | ||||||
| import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; | import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; | ||||||
| import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; | import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; | ||||||
| @@ -72,9 +71,10 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, | |||||||
|     @Operation(summary = "分页查询列表", description = "分页查询列表") |     @Operation(summary = "分页查询列表", description = "分页查询列表") | ||||||
|     @ResponseBody |     @ResponseBody | ||||||
|     @GetMapping |     @GetMapping | ||||||
|     public PageDataResp<L> page(Q query, @Validated PageQuery pageQuery) { |     public R<PageDataResp<L>> page(Q query, @Validated PageQuery pageQuery) { | ||||||
|         this.checkPermission(Api.LIST); |         this.checkPermission(Api.LIST); | ||||||
|         return baseService.page(query, pageQuery); |         PageDataResp<L> pageData = baseService.page(query, pageQuery); | ||||||
|  |         return R.ok(pageData); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -89,9 +89,10 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, | |||||||
|     @Operation(summary = "查询树列表", description = "查询树列表") |     @Operation(summary = "查询树列表", description = "查询树列表") | ||||||
|     @ResponseBody |     @ResponseBody | ||||||
|     @GetMapping("/tree") |     @GetMapping("/tree") | ||||||
|     public List<Tree<Long>> tree(Q query, SortQuery sortQuery) { |     public R<List<Tree<Long>>> tree(Q query, SortQuery sortQuery) { | ||||||
|         this.checkPermission(Api.LIST); |         this.checkPermission(Api.LIST); | ||||||
|         return baseService.tree(query, sortQuery, false); |         List<Tree<Long>> list = baseService.tree(query, sortQuery, false); | ||||||
|  |         return R.ok(list); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -106,9 +107,10 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, | |||||||
|     @Operation(summary = "查询列表", description = "查询列表") |     @Operation(summary = "查询列表", description = "查询列表") | ||||||
|     @ResponseBody |     @ResponseBody | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public List<L> list(Q query, SortQuery sortQuery) { |     public R<List<L>> list(Q query, SortQuery sortQuery) { | ||||||
|         this.checkPermission(Api.LIST); |         this.checkPermission(Api.LIST); | ||||||
|         return baseService.list(query, sortQuery); |         List<L> list = baseService.list(query, sortQuery); | ||||||
|  |         return R.ok(list); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -122,9 +124,10 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, | |||||||
|     @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) |     @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) | ||||||
|     @ResponseBody |     @ResponseBody | ||||||
|     @GetMapping("/{id}") |     @GetMapping("/{id}") | ||||||
|     public D get(@PathVariable Long id) { |     public R<D> get(@PathVariable Long id) { | ||||||
|         this.checkPermission(Api.LIST); |         this.checkPermission(Api.LIST); | ||||||
|         return baseService.get(id); |         D detail = baseService.get(id); | ||||||
|  |         return R.ok(detail); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -190,7 +193,6 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, | |||||||
|      *            响应对象 |      *            响应对象 | ||||||
|      */ |      */ | ||||||
|     @Operation(summary = "导出数据", description = "导出数据") |     @Operation(summary = "导出数据", description = "导出数据") | ||||||
|     @NoResponseAdvice |  | ||||||
|     @GetMapping("/export") |     @GetMapping("/export") | ||||||
|     public void export(Q query, SortQuery sortQuery, HttpServletResponse response) { |     public void export(Q query, SortQuery sortQuery, HttpServletResponse response) { | ||||||
|         this.checkPermission(Api.EXPORT); |         this.checkPermission(Api.EXPORT); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user