mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	【代码优化】框架:简化 api 访问日志、错误日志的记录逻辑
This commit is contained in:
		| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.infra.api.logger; | ||||
| import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; | ||||
|  | ||||
| import jakarta.validation.Valid; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
|  | ||||
| /** | ||||
|  * API 访问日志的 API 接口 | ||||
| @@ -18,4 +19,14 @@ public interface ApiAccessLogApi { | ||||
|      */ | ||||
|     void createApiAccessLog(@Valid ApiAccessLogCreateReqDTO createDTO); | ||||
|  | ||||
|     /** | ||||
|      * 【异步】创建 API 访问日志 | ||||
|      * | ||||
|      * @param createDTO 访问日志 DTO | ||||
|      */ | ||||
|     @Async | ||||
|     default void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) { | ||||
|         createApiAccessLog(createDTO); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.infra.api.logger; | ||||
| import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; | ||||
|  | ||||
| import jakarta.validation.Valid; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
|  | ||||
| /** | ||||
|  * API 错误日志的 API 接口 | ||||
| @@ -18,4 +19,14 @@ public interface ApiErrorLogApi { | ||||
|      */ | ||||
|     void createApiErrorLog(@Valid ApiErrorLogCreateReqDTO createDTO); | ||||
|  | ||||
|     /** | ||||
|      * 【异步】创建 API 异常日志 | ||||
|      * | ||||
|      * @param createDTO 异常日志 DTO | ||||
|      */ | ||||
|     @Async | ||||
|     default void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) { | ||||
|         createApiErrorLog(createDTO); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV