From 5b8fdd9399cb90e28ed8cac5dfbc45956cab4b7e Mon Sep 17 00:00:00 2001 From: qiucong Date: Wed, 11 Nov 2020 20:03:56 +0800 Subject: [PATCH] =?UTF-8?q?DEC-15854=20fix:=20=E3=80=90=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E3=80=91=E6=96=B0=E5=BB=BA=E5=85=B6=E4=BB=96?= =?UTF-8?q?JDBC=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E9=A9=B1=E5=8A=A8=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 1 + src/modules/app.service.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index 2416310..e9711dc 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -19,6 +19,7 @@ test('DEC-11030 拼接url', () => { */ test('BI-56355 如果数据库类型和驱动都为空,则为其他jdbc', () => { expect(getJdbcDatabaseType('', '').databaseType).toEqual('otherJDBC'); + expect(getJdbcDatabaseType('otherJDBC', 'org.h2.Driver').databaseType).toEqual('otherJDBC'); expect(getJdbcDatabaseType('mysql', '').databaseType).toEqual('mysql'); expect(getJdbcDatabaseType('', 'com.mysql.jdbc.Driver').databaseType).toEqual('mysql'); }); diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 0014d28..d8a0a2c 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -1,4 +1,4 @@ -import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE } from '@constants/constant'; +import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant'; import { CONSTANT_PLUGIN_TYPES } from './app.constant'; import { DatabaseType } from './app.typings'; import { Connection } from './crud/crud.typings'; @@ -32,7 +32,8 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT } let databaseType = null; // 从全部数据库类型中获取jdbc类型的 - const jdbcDatabases = getAllDatabaseTypes().filter(v => v.type === 'jdbc'); + // 兼容之前的逻辑,otherJdbc要单独处理一下 + const jdbcDatabases = getAllDatabaseTypes().filter(v => v.type === 'jdbc' || v.type === OTHER_JDBC); // KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driver来判断数据类型 if (database && database !== 'other' && jdbcDatabases.some(item => item.databaseType === database)) { databaseType = jdbcDatabases.find(item => item.databaseType === database);