|
|
@@ -13,6 +13,7 @@ import com.vcarecity.cvs.properties.DbProperties;
|
|
13
|
13
|
import com.vcarecity.cvs.service.ResultHandlerService;
|
|
14
|
14
|
import com.vcarecity.cvs.service.SQLQueryService;
|
|
15
|
15
|
import com.vcarecity.cvs.service.impl.*;
|
|
|
16
|
+import com.vcarecity.cvs.type.ResultHandlerEnum;
|
|
16
|
17
|
import com.vcarecity.cvs.util.CreateDatasource;
|
|
17
|
18
|
import com.zaxxer.hikari.HikariDataSource;
|
|
18
|
19
|
|
|
|
@@ -21,10 +22,10 @@ import com.zaxxer.hikari.HikariDataSource;
|
|
21
|
22
|
*/
|
|
22
|
23
|
|
|
23
|
24
|
public class SQLModule extends AbstractModule {
|
|
24
|
|
- private final boolean isMysql;
|
|
|
25
|
+ private final ResultHandlerEnum resultHandlerEnum;
|
|
25
|
26
|
|
|
26
|
|
- public SQLModule(boolean isMysql) {
|
|
27
|
|
- this.isMysql = isMysql;
|
|
|
27
|
+ public SQLModule(ResultHandlerEnum resultHandlerEnum) {
|
|
|
28
|
+ this.resultHandlerEnum = resultHandlerEnum;
|
|
28
|
29
|
}
|
|
29
|
30
|
|
|
30
|
31
|
@Override
|
|
|
@@ -33,11 +34,21 @@ public class SQLModule extends AbstractModule {
|
|
33
|
34
|
bind(ExportEventListener.class).to(MySQLImportEvent.class);
|
|
34
|
35
|
|
|
35
|
36
|
Class<? extends ResultHandlerService> resultClass;
|
|
36
|
|
- if (isMysql) {
|
|
37
|
|
- resultClass = MySQLResultStatHandlerServiceImpl.class;
|
|
38
|
|
- //resultClass = MySQLResultHandlerServiceImpl.class;
|
|
39
|
|
- } else {
|
|
40
|
|
- resultClass = CSVResultHandlerServiceImpl.class;
|
|
|
37
|
+
|
|
|
38
|
+ switch (resultHandlerEnum) {
|
|
|
39
|
+ case CSV:
|
|
|
40
|
+ resultClass = CSVResultHandlerServiceImpl.class;
|
|
|
41
|
+ break;
|
|
|
42
|
+ case MYSQL:
|
|
|
43
|
+ resultClass = MySQLResultStatHandlerServiceImpl.class;
|
|
|
44
|
+ break;
|
|
|
45
|
+ case MYSQL_PS:
|
|
|
46
|
+ resultClass = MySQLResultHandlerServiceImpl.class;
|
|
|
47
|
+ break;
|
|
|
48
|
+ case DEFAULT:
|
|
|
49
|
+ default:
|
|
|
50
|
+ resultClass = LogResultHandlerServiceImpl.class;
|
|
|
51
|
+ break;
|
|
41
|
52
|
}
|
|
42
|
53
|
|
|
43
|
54
|
install(new FactoryModuleBuilder()
|