From ae403b4e16296712de0fd3e954a83d6279420121 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 02 Jun 2026 09:57:50 +0800
Subject: [PATCH] refactor(okxNewPrice): 更新配置并优化网格交易初始化逻辑
---
src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java | 52 +---------------------------------------------------
1 files changed, 1 insertions(+), 51 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java b/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java
index 144a8c0..46aad94 100644
--- a/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java
+++ b/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java
@@ -1,8 +1,5 @@
package com.xcong.excoin.configurations.interceptor;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.MappedStatement;
@@ -11,7 +8,6 @@
import org.apache.ibatis.session.defaults.DefaultSqlSession;
import org.springframework.stereotype.Component;
-import java.lang.reflect.Field;
import java.util.*;
/**
@@ -22,43 +18,16 @@
**/
@Slf4j
@Component
-@Intercepts({ @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
+@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
public class MybatisInterceptor implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
- String sqlId = mappedStatement.getId();
- log.info("----sqlId----" + sqlId);
SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
- log.info("-------------->{}", sqlCommandType);
Object parameter = invocation.getArgs()[1];
if (parameter == null) {
return invocation.proceed();
- }
-
- if (SqlCommandType.INSERT == sqlCommandType) {
- if (parameter instanceof DefaultSqlSession.StrictMap) {
- Map map = (Map) parameter;
- List list = (List) map.get("list");
- for (Object o : list) {
- injectForInsert(o);
- }
- } else {
- injectForInsert(parameter);
- }
- }
-
- if (SqlCommandType.UPDATE == sqlCommandType) {
- if (parameter instanceof DefaultSqlSession.StrictMap) {
- Map map = (Map) parameter;
- List list = (List) map.get("list");
- for (Object o : list) {
- injectForUpdate(o);
- }
- } else {
- injectForUpdate(parameter);
- }
}
return invocation.proceed();
@@ -74,23 +43,4 @@
}
- public void injectForInsert(Object o) {
- MemberEntity member = LoginUserUtils.getAppLoginUser();
- if (o instanceof BaseEntity) {
- BaseEntity baseEntity = (BaseEntity) o;
- baseEntity.setCreateBy(member.getUsername());
- baseEntity.setUpdateBy(member.getUsername());
- baseEntity.setCreateTime(new Date());
- baseEntity.setUpdateTime(new Date());
- }
- }
-
- public void injectForUpdate(Object o) {
- MemberEntity member = LoginUserUtils.getAppLoginUser();
- if (o instanceof BaseEntity) {
- BaseEntity baseEntity = (BaseEntity) o;
- baseEntity.setUpdateBy(member.getUsername());
- baseEntity.setUpdateTime(new Date());
- }
- }
}
--
Gitblit v1.9.1