2、自定义Jackson starter
This commit is contained in:
+17
-8
@@ -1,4 +1,4 @@
|
||||
package top.crushtj.framework.biz.operationlog;
|
||||
package com.jy.framework.biz.operationlog;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
@@ -12,19 +12,28 @@ import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import top.crushtj.framework.biz.operationlog.aspect.ApiOperationLog;
|
||||
import top.crushtj.framework.common.utils.JsonUtils;
|
||||
import com.jy.framework.biz.operationlog.aspect.ApiOperationLog;
|
||||
import com.jy.framework.common.utils.JsonUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ayi
|
||||
* @title ApiOperationLog
|
||||
* @description 自定义注解,用于标记需要记录操作日志的方法
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Aspect
|
||||
public class ApiOperationLogAspect {
|
||||
/** 以自定义 @ApiOperationLog 注解为切点,凡是添加 @ApiOperationLog 的方法,都会执行环绕中的代码 */
|
||||
@Pointcut("@annotation(top.crushtj.framework.biz.operationlog.aspect.ApiOperationLog)")
|
||||
public void apiOperationLog() {}
|
||||
@Pointcut("@annotation(com.jy.framework.biz.operationlog.aspect.ApiOperationLog)")
|
||||
public void apiOperationLog() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 环绕
|
||||
*
|
||||
*
|
||||
* @param joinPoint 连接点
|
||||
* @return 方法执行结果
|
||||
* @throws Throwable 方法执行过程中抛出的异常
|
||||
@@ -65,7 +74,7 @@ public class ApiOperationLogAspect {
|
||||
|
||||
/**
|
||||
* 获取注解的描述信息
|
||||
*
|
||||
*
|
||||
* @param joinPoint 连接点
|
||||
* @return 注解的描述信息
|
||||
*/
|
||||
@@ -85,7 +94,7 @@ public class ApiOperationLogAspect {
|
||||
|
||||
/**
|
||||
* 转 JSON 字符串
|
||||
*
|
||||
*
|
||||
* @return 入参的 JSON 字符串
|
||||
*/
|
||||
private Function<Object, String> toJsonStr() {
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
package top.crushtj.framework.biz.operationlog.aspect;
|
||||
package com.jy.framework.biz.operationlog.aspect;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
@@ -8,10 +8,10 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Title: ApiOperationLog
|
||||
* @Description: 自定义注解,用于标记需要记录操作日志的方法
|
||||
* @Author: ayi
|
||||
* @Date: 2025/11/21
|
||||
* @author ayi
|
||||
* @title ApiOperationLog
|
||||
* @description 自定义注解,用于标记需要记录操作日志的方法
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
@@ -20,7 +20,7 @@ public @interface ApiOperationLog {
|
||||
/**
|
||||
* API 功能描述
|
||||
*
|
||||
* @return
|
||||
* @return 功能描述
|
||||
*/
|
||||
String description() default "";
|
||||
}
|
||||
+10
-2
@@ -1,9 +1,17 @@
|
||||
package top.crushtj.framework.biz.operationlog.config;
|
||||
package com.jy.framework.biz.operationlog.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import top.crushtj.framework.biz.operationlog.ApiOperationLogAspect;
|
||||
import com.jy.framework.biz.operationlog.ApiOperationLogAspect;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ayi
|
||||
* @title ApiOperationLog
|
||||
* @description 自定义注解,用于标记需要记录操作日志的方法
|
||||
* @date 2025/11/21
|
||||
*/
|
||||
|
||||
@AutoConfiguration
|
||||
public class ApiOperationLogAutoConfiguration {
|
||||
+1
-1
@@ -1 +1 @@
|
||||
top.crushtj.framework.biz.operationlog.config.ApiOperationLogAutoConfiguration
|
||||
com.jy.framework.biz.operationlog.config.ApiOperationLogAutoConfiguration
|
||||
Reference in New Issue
Block a user