diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java index b781294..738468c 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java @@ -75,12 +75,10 @@ public class MybatisSqlInterceptor implements Interceptor { Object[] args = invocation.getArgs(); Object returnValue = null; System.out.println("args length = "+args.length); - System.out.println("time1=========" + (System.currentTimeMillis()-start)); try { if (args != null && args.length == 2) { - System.out.println("time2=========" + (System.currentTimeMillis()-start)); MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; Object parameter = null; if (invocation.getArgs().length > 1) { @@ -90,40 +88,34 @@ public class MybatisSqlInterceptor implements Interceptor { BoundSql boundSql = mappedStatement.getBoundSql(parameter); Configuration configuration = mappedStatement.getConfiguration(); sqlCommandType = mappedStatement.getSqlCommandType().name(); - - System.out.println("time3=========" + (System.currentTimeMillis()-start)); - System.out.println("sqlCommandType = "+sqlCommandType); - if ("update".equals(sqlCommandType.toLowerCase()) || "delete".equals(sqlCommandType.toLowerCase())) - { - sql = getSql(configuration, boundSql, sqlId); - System.out.println("sql = "+sql); - if (isSyncTable(sql)) - { - - System.out.println("delete or update sync sql = " + sql); - //发送要同步的sql - SendMysqlSyncDatUtil.addSqlToQueue(sql, sqlId); - sql = null; - System.out.println("time4=========" + (System.currentTimeMillis()-start)); - } - } - else if ("insert".equals(sqlCommandType.toLowerCase()) ) +// if ("update".equals(sqlCommandType.toLowerCase()) || "delete".equals(sqlCommandType.toLowerCase())) +// { +// sql = getSql(configuration, boundSql, sqlId); +// System.out.println("sql = "+sql); +// if (isSyncTable(sql)) +// { +// +// System.out.println("delete or update sync sql = " + sql); +// //发送要同步的sql +// SendMysqlSyncDatUtil.addSqlToQueue(sql, sqlId); +// sql = null; +// System.out.println("time4=========" + (System.currentTimeMillis()-start)); +// } +// } +// else + if ("insert".equals(sqlCommandType.toLowerCase()) ) { - System.out.println("time5=========" + (System.currentTimeMillis()-start)); String tempSql = getSql(configuration, boundSql, sqlId); if (isSyncTable(tempSql)) { sql = tempSql; - System.out.println("sql = "+sql); - System.out.println("time6=========" + (System.currentTimeMillis()-start)); } } returnValue = invocation.proceed(); - System.out.println("time7=========" + (System.currentTimeMillis()-start)); + } else { - System.out.println("time8=========" + (System.currentTimeMillis()-start)); returnValue = invocation.proceed(); if (StringUtils.isNotEmpty(sql) && sqlCommandType != null && "insert".equals(sqlCommandType.toLowerCase())) { @@ -138,12 +130,10 @@ public class MybatisSqlInterceptor implements Interceptor { //发送要同步的sql SendMysqlSyncDatUtil.addSqlToQueue(sql, sqlId); sql = null; - System.out.println("time9=========" + (System.currentTimeMillis()-start)); } } } } - System.out.println("time10=========" + (System.currentTimeMillis()-start)); }catch (Exception e) { ExceptionUtils.catchException(e," Mybatis Sql Interceptor exception"); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SendMysqlSyncDatUtil.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SendMysqlSyncDatUtil.java index 6641efd..910b9aa 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SendMysqlSyncDatUtil.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SendMysqlSyncDatUtil.java @@ -76,7 +76,6 @@ public class SendMysqlSyncDatUtil implements InitializingBean { SqlRequest request = null; while (true) { try { - System.out.println("get resuest = " + request+" size = "+syncSqlQueue.size()); request = syncSqlQueue.poll(1, TimeUnit.MINUTES); String json = JsonUtil.obj2Str(request); if (CollectionUtils.isNotEmpty(urls))