Browse Source

Merge pull request #88 in DEC/decision-webui-dcm from ~ALAN/decision-webui-dcm:feature/10.0 to feature/10.0

* commit 'acd47c3064e242e1bf8cfb808f255c79b9de672d':
  fix: DEC-10161 匹配从设计器上添加的数据类型
qufenxi
alan 5 years ago
parent
commit
d194075945
  1. 11
      src/modules/app.service.ts
  2. 30
      src/modules/constants/constant.ts

11
src/modules/app.service.ts

@ -1,4 +1,4 @@
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER } from '@constants/constant';
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE } from '@constants/constant';
import { CONSTANT_PLUGIN_TYPES, CONSTANT_PLUGIN_SHOW, CONSTANT_PLUGIN_EDIT } from '@constants/plugin';
import { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings';
@ -29,13 +29,8 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
if (database && DATA_BASE_TYPES.some(item => item.databaseType === database)) {
databaseType = DATA_BASE_TYPES.find(item => item.databaseType === database);
} else {
databaseType = (DATA_BASE_TYPES as DatabaseType[]).find(item => {
if (item.drivers) {
return item.drivers.includes(driver);
}
return item.driver === driver;
});
const desingDatabase = DESIGN_DRIVER_TYPE.find(item => item.driver === driver);
databaseType = DATA_BASE_TYPES.find(item => item.databaseType === BI.get(desingDatabase, 'type'));
}
if (!databaseType) {
return DATA_BASE_TYPES_OTHER;

30
src/modules/constants/constant.ts

@ -166,6 +166,36 @@ export const DATA_BASE_DRIVER_LINK = DecCst && DecCst.Hyperlink ? [
link: DecCst.Hyperlink.Database.OTHER,
},
] : [];
export const DESIGN_DRIVER_TYPE = [
{
type: 'mysql',
driver: 'com.mysql.jdbc.Driver',
},
{
type: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
},
{
type: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
},
{
type: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
},
{
type: 'postgresql',
driver: 'org.postgresql.Driver',
},
{
type: 'sqlite',
driver: 'org.sqlite.JDBC',
},
{
type: 'transwarp-inceptor',
driver: 'org.apache.hive.jdbc.HiveDriver',
},
];
export const DATA_BASE_TYPES = [
{
text: 'ADS',

Loading…
Cancel
Save