REQ-2135: update log

This commit is contained in:
yanglin 2024-04-03 13:33:16 +08:00
parent 2ff86b4ac7
commit ae7126a5c2
2 changed files with 5 additions and 1 deletions

View File

@ -31,7 +31,10 @@ class LogExecSQLInterceptor implements Interceptor {
String sql = SQLAccessor.getSQL(invocation);
if (StringUtils.isNotBlank(sql)) {
sql = sql.replaceAll("[\r\n]", " ");
log.info("\n{}", SQLUtils.formatMySql(sql));
if (props.isFormatSQL())
log.info("\n{}", SQLUtils.formatMySql(sql));
else
log.info("{}", sql);
}
}
return proceed;

View File

@ -15,6 +15,7 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties(prefix = "mybatis-plus.configuration")
public class MyBatisProperties {
private boolean logExecSQL;
private boolean formatSQL;
@Override
public String toString() {