From 1ffbaa7b82f99443d933b0f7d0add0b35d2db01c Mon Sep 17 00:00:00 2001 From: wangrenhuang <wangren_huang@163.com> Date: 星期三, 02 三月 2022 14:26:53 +0800 Subject: [PATCH] PTEncryptionUti新增解密方法 --- src/main/java/com/hx/mybatis/aes/springbean/SqlUtils.java | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hx/mybatis/aes/springbean/SqlUtils.java b/src/main/java/com/hx/mybatis/aes/springbean/SqlUtils.java index 90d2228..fe8e437 100644 --- a/src/main/java/com/hx/mybatis/aes/springbean/SqlUtils.java +++ b/src/main/java/com/hx/mybatis/aes/springbean/SqlUtils.java @@ -39,8 +39,6 @@ //鑾峰彇鏍煎紡鍖栫殑slq璇彞 sql = sqlStatement.toString(); - System.out.println("sql:"+sql); - //瑙f瀽select鏌ヨ //SQLSelect sqlSelect = sqlStatement.getSelect() //鑾峰彇sql鏌ヨ鍧� @@ -140,7 +138,7 @@ }else{ tableAl = column.getName(); } - sql = sql.replaceAll("\\b"+tableAl+"\\b","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); + sql = sql.replaceAll("((?<!\\.)\\b"+tableAl+"\\b(?!\\.))","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); } } return sqlSelect.toString()+sql; @@ -249,7 +247,7 @@ }else{ tableAl = column.getName(); } - sql = sql.replaceAll("\\b"+tableAl+"\\b","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); + sql = sql.replaceAll("((?<!\\.)\\b"+tableAl+"\\b(?!\\.))","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); } } return sqlSelect.toString()+sql; @@ -413,7 +411,7 @@ }else{ tableAl = column.getName(); } - sqlWhere = sqlWhere.replaceAll("\\b"+tableAl+"\\b","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); + sqlWhere = sqlWhere.replaceAll("((?<!\\.)\\b"+tableAl+"\\b(?!\\.))","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); } } @@ -491,7 +489,7 @@ }else{ tableAl = column.getName(); } - sqlWhere = sqlWhere.replaceAll("\\b"+tableAl+"\\b","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); + sqlWhere = sqlWhere.replaceAll("((?<!\\.)\\b"+tableAl+"\\b(?!\\.))","AES_DECRYPT(UNHEX("+tableAl+"),'"+aeskey+"')"); } } -- Gitblit v1.8.0