支持mongodb

This commit is contained in:
inrgihc
2023-08-21 23:19:01 +08:00
parent ae1d28f896
commit 3ee96f87c6
42 changed files with 634 additions and 33 deletions

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.gitee.dbswitch</groupId>
<artifactId>dbswitch-parent</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<artifactId>dbswitch-admin</artifactId>

View File

@@ -9,7 +9,6 @@
/////////////////////////////////////////////////////////////
package com.gitee.dbswitch.admin.service;
import com.gitee.dbswitch.common.converter.ConverterFactory;
import com.gitee.dbswitch.admin.common.exception.DbswitchException;
import com.gitee.dbswitch.admin.common.response.PageResult;
import com.gitee.dbswitch.admin.common.response.Result;
@@ -28,6 +27,7 @@ import com.gitee.dbswitch.admin.model.response.AssignmentDetailResponse;
import com.gitee.dbswitch.admin.model.response.AssignmentInfoResponse;
import com.gitee.dbswitch.admin.type.ScheduleModeEnum;
import com.gitee.dbswitch.admin.util.PageUtils;
import com.gitee.dbswitch.common.converter.ConverterFactory;
import com.gitee.dbswitch.common.type.ProductTypeEnum;
import com.gitee.dbswitch.data.config.DbswichProperties;
import com.gitee.dbswitch.data.entity.SourceDataSourceProperties;
@@ -72,13 +72,19 @@ public class AssignmentService {
assignmentConfigDAO.insert(assignmentConfigEntity);
Long targetConnectionId = assignmentConfigEntity.getTargetConnectionId();
DatabaseConnectionEntity entity = databaseConnectionDAO.getById(targetConnectionId);
if (ProductTypeEnum.SQLITE3 == entity.getType()) {
if (ProductTypeEnum.isUnsupportedTargetSqlite(entity.getUrl())) {
DatabaseConnectionEntity targetEntity = databaseConnectionDAO.getById(targetConnectionId);
if (ProductTypeEnum.SQLITE3 == targetEntity.getType()) {
if (ProductTypeEnum.isUnsupportedTargetSqlite(targetEntity.getUrl())) {
throw new DbswitchException(ResultCode.ERROR_INVALID_ASSIGNMENT_CONFIG,
"不支持目的端数据源为远程服务器上的SQLite或内存方式下的SQLite");
}
}
Long sourceConnectionId = assignmentConfigEntity.getSourceConnectionId();
DatabaseConnectionEntity sourceEntity = databaseConnectionDAO.getById(sourceConnectionId);
if (ProductTypeEnum.MONGODB == sourceEntity.getType()) {
throw new DbswitchException(ResultCode.ERROR_INVALID_ASSIGNMENT_CONFIG,
"不支持源端数据源为MongoDB数据库");
}
return ConverterFactory.getConverter(AssignmentInfoConverter.class)
.convert(assignmentTaskDAO.getById(assignment.getId()));
@@ -114,6 +120,12 @@ public class AssignmentService {
"不支持目的端数据源为远程服务器上的SQLite或内存方式下的SQLite");
}
}
Long sourceConnectionId = assignmentConfigEntity.getSourceConnectionId();
DatabaseConnectionEntity sourceEntity = databaseConnectionDAO.getById(sourceConnectionId);
if (ProductTypeEnum.MONGODB == sourceEntity.getType()) {
throw new DbswitchException(ResultCode.ERROR_INVALID_ASSIGNMENT_CONFIG,
"不支持源端数据源为MongoDB数据库");
}
}
public PageResult<AssignmentInfoResponse> listAll(String searchText, Integer page, Integer size) {