Skip to content

Commit

Permalink
fix: 打印统计细腻系
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdehai committed Aug 6, 2024
1 parent 72725f8 commit 491e4a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<properties>
<!-- 版本信息 -->
<revision>2.3.18-RELEASE</revision>
<revision>2.3.19-RELEASE</revision>

<!-- 默认仓库地址 -->
<repository.nexus.url>https://maven.aliyun.com/repository/public</repository.nexus.url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Object intercept(Invocation invocation) throws Exception {
try {
Object target = invocation.getTarget();
Parse p = new Parse();
// 非查询走这里(非查询不走ResultSetHandler接口,所以放在这里)
// 非查询走这里(非查询不走ResultSetHandler接口,所以放在这里, 直接打印sql)
if (target instanceof ParameterHandler) {
MetaObject m = config.newMetaObject(target);
MappedStatement ms = (MappedStatement) m.getValue("mappedStatement");
Expand All @@ -112,9 +112,13 @@ public Object intercept(Invocation invocation) throws Exception {
p.id = ms.getId();
processSql(ms.getId(), ms.getBoundSql(m.getValue("parameterObject")), p);
}
// 对于((PreparedStatement) countStmt).execute()这种方式执行的sql, 不会走ResultSetHandler拦截, 所以不会走下方的查询逻辑, 因此打印sql放在这里, 而分页插件就包含((PreparedStatement) countStmt).execute()这种查询
else if(ms.getId().contains("分页统计")) {
p = getSql(invocation);
}
}

// 查询走这里
// 查询走这里, 这里会生成sql
else {
p = getSql(invocation);
}
Expand Down

0 comments on commit 491e4a6

Please sign in to comment.