Skip to content

Commit 61f960e

Browse files
Mybatis 插件开发
1 parent 45f297a commit 61f960e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ build/
2121
nbbuild/
2222
dist/
2323
nbdist/
24-
.nb-gradle/
24+
.nb-gradle/
25+
*.log

spring-boot-student-mybatis/src/main/java/com/xiaolyuh/mybatis/EditPlugin.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.xiaolyuh.mybatis;
22

3+
import com.alibaba.fastjson.JSON;
34
import org.apache.ibatis.executor.Executor;
45
import org.apache.ibatis.mapping.MappedStatement;
56
import org.apache.ibatis.plugin.Interceptor;
@@ -29,7 +30,7 @@ public Object intercept(Invocation invocation) throws Throwable {
2930
Object[] args = invocation.getArgs();
3031
MappedStatement statement = (MappedStatement) args[0];
3132
String sql = statement.getBoundSql(args[1]).getSql();
32-
System.out.println("--------intercept method: " + statement.getId() + "-----sql: " + sql);
33+
System.out.println("--------intercept method: " + statement.getId() + "\n-----sql: " + sql + "\n------args: " + JSON.toJSONString(args[1]));
3334
//执行目标方法
3435
return invocation.proceed();
3536
}

0 commit comments

Comments
 (0)