From 220da5159c5ce32f9096e02316b4c9019b09dba7 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期一, 06 十一月 2023 17:27:15 +0800
Subject: [PATCH] 1.新增工具类

---
 src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java b/src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java
index 2d94032..cff0067 100644
--- a/src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java
+++ b/src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java
@@ -10,6 +10,8 @@
 import org.apache.ibatis.reflection.MetaObject;
 import org.apache.ibatis.reflection.SystemMetaObject;
 import org.apache.ibatis.session.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Field;
@@ -25,6 +27,8 @@
         })
 })
 public class MySqlInterceptor implements Interceptor {
+
+    private static Logger logger = LoggerFactory.getLogger(MySqlInterceptor.class.getName());
     @Override
     public Object intercept(Invocation invocation) throws Throwable {
 
@@ -58,7 +62,6 @@
         //杩欓噷鍙互杩涜sql淇敼
         //鑾峰彇鍒板師濮媠ql璇彞
         String sql = boundSql.getSql();
-
         //鏂板
         if(sqlCommandType == SqlCommandType.INSERT){
             sql = SqlUtils.insertSql(sql, VariableAesKey.aesKeysTable);
@@ -72,14 +75,10 @@
             sql = SqlUtils.deleteSql(sql, VariableAesKey.aesKeysTable);
         }
 
-
-
-        if(!"err".equals(sql)){
-            //閫氳繃鍙嶅皠淇敼sql璇彞
-            Field field = boundSql.getClass().getDeclaredField("sql");
-            field.setAccessible(true);
-            field.set(boundSql, sql);
-        }
+        //閫氳繃鍙嶅皠淇敼sql璇彞
+        Field field = boundSql.getClass().getDeclaredField("sql");
+        field.setAccessible(true);
+        field.set(boundSql, sql);
 
         return invocation.proceed();
 

--
Gitblit v1.8.0