fix: 新增全局响应结果处理器

实现ResponseBodyAdvice接口,可以将相同的处理逻辑抽取出来,避免了在多个Controller中重复编写代码,提高了代码的可维护性和可读性。同时,对返回结果进行统一格式化、异常处理等处理,使得返回结果更加规范、易于处理和阅读。
This commit is contained in:
Bull-BCLS
2023-10-12 23:12:41 +08:00
parent c0ee2eac02
commit 992a8fca17
11 changed files with 160 additions and 80 deletions

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* 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 top.charles7c.cnadmin.common.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 2023/10/8 20:44
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface NoResponseAdvice {}