Commit b9a8771df7d10fb86ee28653240832b0eae89ef4
1 parent
2be1b52657
Exists in
master
and in
6 other branches
mysql数据同步
Showing 1 changed file with 5 additions and 2 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java
View file @
b9a8771
| 1 | 1 | package com.lyms.platform.operate.web.inteceptor; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import java.sql.Statement; | |
| 4 | 5 | import java.text.DateFormat; |
| 5 | 6 | import java.util.Date; |
| 6 | 7 | import java.util.List; |
| ... | ... | @@ -9,6 +10,7 @@ |
| 9 | 10 | |
| 10 | 11 | import com.lyms.platform.operate.web.utils.SendMysqlSyncDatUtil; |
| 11 | 12 | import org.apache.ibatis.executor.Executor; |
| 13 | +import org.apache.ibatis.executor.resultset.ResultSetHandler; | |
| 12 | 14 | import org.apache.ibatis.mapping.BoundSql; |
| 13 | 15 | import org.apache.ibatis.mapping.MappedStatement; |
| 14 | 16 | import org.apache.ibatis.mapping.ParameterMapping; |
| ... | ... | @@ -25,7 +27,9 @@ |
| 25 | 27 | * Created by Administrator on 2017-04-24. |
| 26 | 28 | */ |
| 27 | 29 | @Intercepts({ |
| 28 | - @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) }) | |
| 30 | + @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }), | |
| 31 | + @Signature(type= ResultSetHandler.class, method = "handleResultSets", args = {Statement.class}) | |
| 32 | + }) | |
| 29 | 33 | public class MybatisSqlInterceptor implements Interceptor { |
| 30 | 34 | |
| 31 | 35 | private Properties properties; |
| ... | ... | @@ -42,7 +46,6 @@ |
| 42 | 46 | Configuration configuration = mappedStatement.getConfiguration(); |
| 43 | 47 | Object returnValue = invocation.proceed(); |
| 44 | 48 | System.out.println("mysql result ======" + returnValue); |
| 45 | - System.out.println( mappedStatement.getResource()); | |
| 46 | 49 | System.out.println(mappedStatement.getResulSets()); |
| 47 | 50 | String sql = getSql(configuration, boundSql, sqlId); |
| 48 | 51 | System.out.println("mysql sql ======" + sql); |