Commit c953df4c6e7974156d0ea6afb563002852616ec2
1 parent
ba4c13c82f
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 11 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java
View file @
c953df4
| ... | ... | @@ -44,13 +44,17 @@ |
| 44 | 44 | |
| 45 | 45 | public Object intercept(Invocation invocation) throws Throwable { |
| 46 | 46 | |
| 47 | + long start = System.currentTimeMillis(); | |
| 48 | + | |
| 47 | 49 | Object[] args = invocation.getArgs(); |
| 48 | 50 | Object returnValue = null; |
| 49 | 51 | System.out.println("args length = "+args.length); |
| 52 | + System.out.println("time1=========" + (System.currentTimeMillis()-start)); | |
| 50 | 53 | try |
| 51 | 54 | { |
| 52 | 55 | if (args != null && args.length == 2) |
| 53 | 56 | { |
| 57 | + System.out.println("time2=========" + (System.currentTimeMillis()-start)); | |
| 54 | 58 | MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; |
| 55 | 59 | Object parameter = null; |
| 56 | 60 | if (invocation.getArgs().length > 1) { |
| ... | ... | @@ -61,6 +65,7 @@ |
| 61 | 65 | Configuration configuration = mappedStatement.getConfiguration(); |
| 62 | 66 | sqlCommandType = mappedStatement.getSqlCommandType().name(); |
| 63 | 67 | |
| 68 | + System.out.println("time3=========" + (System.currentTimeMillis()-start)); | |
| 64 | 69 | System.out.println("sqlCommandType = "+sqlCommandType); |
| 65 | 70 | if ("update".equals(sqlCommandType.toLowerCase()) || "delete".equals(sqlCommandType.toLowerCase())) |
| 66 | 71 | { |
| 67 | 72 | |
| 68 | 73 | |
| 69 | 74 | |
| ... | ... | @@ -73,21 +78,25 @@ |
| 73 | 78 | //发送要同步的sql |
| 74 | 79 | SendMysqlSyncDatUtil.addSqlToQueue(sql, sqlId); |
| 75 | 80 | sql = null; |
| 81 | + System.out.println("time4=========" + (System.currentTimeMillis()-start)); | |
| 76 | 82 | } |
| 77 | 83 | } |
| 78 | 84 | else if ("insert".equals(sqlCommandType.toLowerCase()) ) |
| 79 | 85 | { |
| 86 | + System.out.println("time5=========" + (System.currentTimeMillis()-start)); | |
| 80 | 87 | String tempSql = getSql(configuration, boundSql, sqlId); |
| 81 | 88 | if (!(tempSql.toUpperCase().contains("LIS_REPORT_TBL") || tempSql.toUpperCase().contains("RIS_REPORT_TBL"))) |
| 82 | 89 | { |
| 83 | 90 | sql = tempSql; |
| 84 | 91 | System.out.println("sql = "+sql); |
| 92 | + System.out.println("time6=========" + (System.currentTimeMillis()-start)); | |
| 85 | 93 | } |
| 86 | 94 | } |
| 87 | 95 | returnValue = invocation.proceed(); |
| 88 | 96 | } |
| 89 | 97 | else |
| 90 | 98 | { |
| 99 | + System.out.println("time7=========" + (System.currentTimeMillis()-start)); | |
| 91 | 100 | returnValue = invocation.proceed(); |
| 92 | 101 | if (StringUtils.isNotEmpty(sql) && sqlCommandType != null && "insert".equals(sqlCommandType.toLowerCase())) |
| 93 | 102 | { |
| 94 | 103 | |
| ... | ... | @@ -102,10 +111,12 @@ |
| 102 | 111 | //发送要同步的sql |
| 103 | 112 | SendMysqlSyncDatUtil.addSqlToQueue(sql, sqlId); |
| 104 | 113 | sql = null; |
| 114 | + System.out.println("time8=========" + (System.currentTimeMillis()-start)); | |
| 105 | 115 | } |
| 106 | 116 | } |
| 107 | 117 | } |
| 108 | 118 | } |
| 119 | + System.out.println("time9=========" + (System.currentTimeMillis()-start)); | |
| 109 | 120 | }catch (Exception e) |
| 110 | 121 | { |
| 111 | 122 | ExceptionUtils.catchException(e," Mybatis Sql Interceptor exception"); |