-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master-jdk21' of https://gitee.com/zhijiantianya/ruoyi-…
…vue-pro # Conflicts: # yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java # yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java # yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java # yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java
- Loading branch information
Showing
20 changed files
with
486 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
...ao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringAopUtils.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cn.iocoder.yudao.framework.common.util.spring; | ||
|
||
import cn.hutool.extra.spring.SpringUtil; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Spring 工具类 | ||
* | ||
* @author 芋道源码 | ||
*/ | ||
public class SpringUtils extends SpringUtil { | ||
|
||
/** | ||
* 是否为生产环境 | ||
* | ||
* @return 是否生产环境 | ||
*/ | ||
public static boolean isProd() { | ||
String activeProfile = getActiveProfile(); | ||
return Objects.equals("prod", activeProfile); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...er-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/annotations/ApiAccessLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package cn.iocoder.yudao.framework.apilog.core.annotations; | ||
|
||
import cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 访问日志注解 | ||
* | ||
* @author 芋道源码 | ||
*/ | ||
@Target({ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ApiAccessLog { | ||
|
||
// ========== 开关字段 ========== | ||
|
||
/** | ||
* 是否记录访问日志 | ||
*/ | ||
boolean enable() default true; | ||
/** | ||
* 是否记录请求参数 | ||
* | ||
* 默认记录,主要考虑请求数据一般不大。可手动设置为 false 进行关闭 | ||
*/ | ||
boolean requestEnable() default true; | ||
/** | ||
* 是否记录响应结果 | ||
* | ||
* 默认不记录,主要考虑响应数据可能比较大。可手动设置为 true 进行打开 | ||
*/ | ||
boolean responseEnable() default false; | ||
/** | ||
* 敏感参数数组 | ||
* | ||
* 添加后,请求参数、响应结果不会记录该参数 | ||
*/ | ||
String[] sanitizeKeys() default {}; | ||
|
||
// ========== 模块字段 ========== | ||
|
||
/** | ||
* 操作模块 | ||
* | ||
* 为空时,会尝试读取 {@link io.swagger.v3.oas.annotations.tags.Tag#name()} 属性 | ||
*/ | ||
String operateModule() default ""; | ||
/** | ||
* 操作名 | ||
* | ||
* 为空时,会尝试读取 {@link io.swagger.v3.oas.annotations.Operation#summary()} 属性 | ||
*/ | ||
String operateName() default ""; | ||
/** | ||
* 操作分类 | ||
* | ||
* 实际并不是数组,因为枚举不能设置 null 作为默认值 | ||
*/ | ||
OperateTypeEnum[] operateType() default {}; | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
...arter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/enums/OperateTypeEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cn.iocoder.yudao.framework.apilog.core.enums; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
/** | ||
* 操作日志的操作类型 | ||
* | ||
* @author ruoyi | ||
*/ | ||
@Getter | ||
@AllArgsConstructor | ||
public enum OperateTypeEnum { | ||
|
||
/** | ||
* 查询 | ||
*/ | ||
GET(1), | ||
/** | ||
* 新增 | ||
*/ | ||
CREATE(2), | ||
/** | ||
* 修改 | ||
*/ | ||
UPDATE(3), | ||
/** | ||
* 删除 | ||
*/ | ||
DELETE(4), | ||
/** | ||
* 导出 | ||
*/ | ||
EXPORT(5), | ||
/** | ||
* 导入 | ||
*/ | ||
IMPORT(6), | ||
/** | ||
* 其它 | ||
* | ||
* 在无法归类时,可以选择使用其它。因为还有操作名可以进一步标识 | ||
*/ | ||
OTHER(0); | ||
|
||
/** | ||
* 类型 | ||
*/ | ||
private final Integer type; | ||
|
||
} |
Oops, something went wrong.