日志打印

This commit is contained in:
xiangerlin 2025-08-11 11:08:10 +08:00
parent 555d59edbf
commit 9adcd1a977
1 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package com.hzya.frame.jdbcUtil.service;
import cn.hutool.core.util.StrUtil;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
@ -55,6 +56,17 @@ public class SqlLogInterceptor implements Interceptor {
Configuration configuration = mappedStatement.getConfiguration();
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
List<String> paramList = getParamList(configuration, boundSql);
// 处理参数列表中的Base64字符串
List<String> processedParamList = new ArrayList<>();
for (String param : paramList) {
if (param != null && param.length() > 2000 && isBase64(param)) {
processedParamList.add("base64");
} else {
processedParamList.add(param);
}
}
if(sql.split("\\?").length > 1 && paramList.size() > 0){
StringBuffer stringBuffer = new StringBuffer();
String[] sqls = sql.split("\\?");