|
|
@@ -2,7 +2,10 @@ package com.fs.tenant.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.domain.entity.SysMenu;
|
|
|
import com.fs.common.enums.DataSourceType;
|
|
|
+import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.tenant.domain.TenantInfo;
|
|
|
import com.fs.tenant.mapper.TenantInfoMapper;
|
|
|
@@ -67,7 +70,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
conn = TenantUtils.getConnection(tenantInfo.getDbIp(),tenantInfo.getDbPort(),"mysql",tenantInfo.getDbAccount(),tenantInfo.getDbPwd());
|
|
|
// 1. 判断是否存在
|
|
|
if (TenantUtils.databaseExists(conn, tenantInfo.getDbName())) {
|
|
|
- throw new RuntimeException("数据库已存在");
|
|
|
+ throw new CustomException("数据库已存在");
|
|
|
}
|
|
|
|
|
|
// 2. 创建数据库
|
|
|
@@ -83,6 +86,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
tenantAsyncService.asyncInit(tenantInfo);
|
|
|
return result;
|
|
|
|
|
|
+ } catch (CustomException e) {
|
|
|
+ throw e;
|
|
|
} catch (Exception e) {
|
|
|
try {
|
|
|
// 删除租户数据库
|