日志打印
This commit is contained in:
parent
555d59edbf
commit
9adcd1a977
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.jdbcUtil.service;
|
package com.hzya.frame.jdbcUtil.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.apache.ibatis.executor.Executor;
|
import org.apache.ibatis.executor.Executor;
|
||||||
import org.apache.ibatis.mapping.BoundSql;
|
import org.apache.ibatis.mapping.BoundSql;
|
||||||
import org.apache.ibatis.mapping.MappedStatement;
|
import org.apache.ibatis.mapping.MappedStatement;
|
||||||
|
@ -55,6 +56,17 @@ public class SqlLogInterceptor implements Interceptor {
|
||||||
Configuration configuration = mappedStatement.getConfiguration();
|
Configuration configuration = mappedStatement.getConfiguration();
|
||||||
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
|
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
|
||||||
List<String> paramList = getParamList(configuration, boundSql);
|
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){
|
if(sql.split("\\?").length > 1 && paramList.size() > 0){
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
String[] sqls = sql.split("\\?");
|
String[] sqls = sql.split("\\?");
|
||||||
|
|
Loading…
Reference in New Issue