Merge pull request #1538 from Zhuoyuan1/main

dbeaver的导入问题修复
This commit is contained in:
Chat2DB
2024-10-28 11:46:50 +08:00
committed by GitHub

View File

@ -231,12 +231,14 @@ public class ConverterServiceImpl implements ConverterService {
dataSourceDO.setSsh(JSON.toJSONString(sshInfo)); dataSourceDO.setSsh(JSON.toJSONString(sshInfo));
if (null != credentialsJson) { if (null != credentialsJson) {
JSONObject userInfo = credentialsJson.getJSONObject(key); JSONObject userInfo = credentialsJson.getJSONObject(key);
JSONObject userPassword = userInfo.getJSONObject(connection); if (null != userInfo) {
dataSourceDO.setUserName(userPassword.getString("user")); JSONObject userPassword = userInfo.getJSONObject(connection);
DesUtil desUtil = new DesUtil(DesUtil.DES_KEY); dataSourceDO.setUserName(userPassword.getString("user"));
String password = userPassword.getString("password"); DesUtil desUtil = new DesUtil(DesUtil.DES_KEY);
String encryptStr = desUtil.encrypt(Optional.ofNullable(password).orElse(""), "CBC"); String password = userPassword.getString("password");
dataSourceDO.setPassword(encryptStr); String encryptStr = desUtil.encrypt(Optional.ofNullable(password).orElse(""), "CBC");
dataSourceDO.setPassword(encryptStr);
}
} }
dataSourceDO.setType(dataBaseType.name()); dataSourceDO.setType(dataBaseType.name());
getDataSourceMapper().insert(dataSourceDO); getDataSourceMapper().insert(dataSourceDO);