From 1c6e572d2d452949ac6b9f75198e1026cc8cb607 Mon Sep 17 00:00:00 2001
From: fwq <582742538@qq.com>
Date: 星期五, 27 五月 2022 16:07:55 +0800
Subject: [PATCH] 增加 检验统一返回状态码的提示

---
 src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 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 cb06b46..cff0067 100644
--- a/src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java
+++ b/src/main/java/com/hx/mybatis/aes/springbean/MySqlInterceptor.java
@@ -62,30 +62,23 @@
         //杩欓噷鍙互杩涜sql淇敼
         //鑾峰彇鍒板師濮媠ql璇彞
         String sql = boundSql.getSql();
-        String sql2 = null;
         //鏂板
         if(sqlCommandType == SqlCommandType.INSERT){
-            sql2 = SqlUtils.insertSql(sql, VariableAesKey.aesKeysTable);
+            sql = SqlUtils.insertSql(sql, VariableAesKey.aesKeysTable);
         }else if(sqlCommandType == SqlCommandType.UPDATE){
-            sql2 = SqlUtils.updateSql(sql, VariableAesKey.aesKeysTable);
+            sql = SqlUtils.updateSql(sql, VariableAesKey.aesKeysTable);
         }else if(sqlCommandType == SqlCommandType.SELECT){
             if(VariableAesKey.isRun == 1){
-                sql2 = SqlUtils.selectSql(sql, VariableAesKey.aesKeysTable);
-            }else{
-                sql2  = sql;
+                sql = SqlUtils.selectSql(sql, VariableAesKey.aesKeysTable);
             }
         }else if(sqlCommandType == SqlCommandType.DELETE){
-            sql2 = SqlUtils.deleteSql(sql, VariableAesKey.aesKeysTable);
-        }else{
-            sql2  = sql;
+            sql = SqlUtils.deleteSql(sql, VariableAesKey.aesKeysTable);
         }
 
-        if(!"err".equals(sql2)){
-            //閫氳繃鍙嶅皠淇敼sql璇彞
-            Field field = boundSql.getClass().getDeclaredField("sql");
-            field.setAccessible(true);
-            field.set(boundSql, sql2);
-        }
+        //閫氳繃鍙嶅皠淇敼sql璇彞
+        Field field = boundSql.getClass().getDeclaredField("sql");
+        field.setAccessible(true);
+        field.set(boundSql, sql);
 
         return invocation.proceed();
 

--
Gitblit v1.8.0