Commit 7fc6af8642885c3881904b2decd5dfb7cb45a8f3
1 parent
cddc5b1f44
Exists in
master
and in
6 other branches
update
Showing 2 changed files with 30 additions and 13 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MybatisSqlInterceptor.java
View file @
7fc6af8
| ... | ... | @@ -45,6 +45,7 @@ |
| 45 | 45 | |
| 46 | 46 | Object[] args = invocation.getArgs(); |
| 47 | 47 | Object returnValue = null; |
| 48 | + System.out.println("args===="+args); | |
| 48 | 49 | if (args != null && args.length == 2) |
| 49 | 50 | { |
| 50 | 51 | MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; |
| ... | ... | @@ -61,6 +62,20 @@ |
| 61 | 62 | sql = getSql(configuration, boundSql, sqlId); |
| 62 | 63 | System.out.println("sqlCommandType = "+sqlCommandType+":mysql sql =" + sql); |
| 63 | 64 | returnValue = invocation.proceed(); |
| 65 | + | |
| 66 | + | |
| 67 | + //排除lis表 | |
| 68 | + if (sql == null || sql.toUpperCase().contains("LIS_REPORT_TBL") || sql.toUpperCase().contains("RIS_REPORT_TBL")) | |
| 69 | + { | |
| 70 | + return returnValue; | |
| 71 | + } | |
| 72 | + if ("UPDATE".equals(sqlCommandType.toLowerCase()) || "DELETE".equals(sqlCommandType.toLowerCase())) | |
| 73 | + { | |
| 74 | + System.out.println("delete and update sync sql = "+sql); | |
| 75 | + //发送要同步的sql | |
| 76 | + SendMysqlSyncDatUtil.sendSql(sql, sqlId); | |
| 77 | + } | |
| 78 | + | |
| 64 | 79 | } |
| 65 | 80 | else |
| 66 | 81 | { |
| 67 | 82 | |
| ... | ... | @@ -74,18 +89,20 @@ |
| 74 | 89 | { |
| 75 | 90 | sql = sql.replaceFirst("\\(","(ID,"); |
| 76 | 91 | sql = sql.substring(0,sql.lastIndexOf("(")+1)+list.get(0)+","+sql.substring(sql.lastIndexOf("(")+1,sql.length()); |
| 92 | + | |
| 93 | + | |
| 94 | + //排除lis表 | |
| 95 | + if (sql == null || sql.toUpperCase().contains("LIS_REPORT_TBL") || sql.toUpperCase().contains("RIS_REPORT_TBL")) | |
| 96 | + { | |
| 97 | + return returnValue; | |
| 98 | + } | |
| 99 | + System.out.println("add sync sql = "+sql); | |
| 100 | + //发送要同步的sql | |
| 101 | + SendMysqlSyncDatUtil.sendSql(sql, sqlId); | |
| 77 | 102 | } |
| 78 | 103 | } |
| 79 | 104 | } |
| 80 | 105 | |
| 81 | - //排除lis表 | |
| 82 | - if (sql == null || sql.toUpperCase().contains("LIS_REPORT_TBL") || sql.toUpperCase().contains("RIS_REPORT_TBL")) | |
| 83 | - { | |
| 84 | - return returnValue; | |
| 85 | - } | |
| 86 | - System.out.println("sync sql = "+sql); | |
| 87 | - //发送要同步的sql | |
| 88 | - SendMysqlSyncDatUtil.sendSql(sql, sqlId); | |
| 89 | 106 | } |
| 90 | 107 | |
| 91 | 108 | return returnValue; |
platform-operate-api/src/main/resources/mybatis.xml
View file @
7fc6af8
| ... | ... | @@ -13,11 +13,11 @@ |
| 13 | 13 | <setting name="defaultStatementTimeout" value="25000" /> |
| 14 | 14 | <setting name="callSettersOnNulls" value="true"/> |
| 15 | 15 | </settings> |
| 16 | - <plugins> | |
| 17 | - <!-- mybatis写出sql记录控件(拦截器) --> | |
| 18 | - <plugin interceptor="com.lyms.platform.operate.web.inteceptor.MybatisSqlInterceptor"> <!-- 自己写的那个拦截器 --> | |
| 19 | - <property name="dialect" value="mysql"/> <!-- mysql的方言 --> | |
| 16 | + <!-- <plugins> | |
| 17 | + mybatis写出sql记录控件(拦截器) | |
| 18 | + <plugin interceptor="com.lyms.platform.operate.web.inteceptor.MybatisSqlInterceptor"> | |
| 19 | + <property name="dialect" value="mysql"/> | |
| 20 | 20 | </plugin> |
| 21 | - </plugins> | |
| 21 | + </plugins> --> | |
| 22 | 22 | </configuration> |