perf[orm]: authSource judgement

This commit is contained in:
godotg committed 2024-05-30 19:22:22 +08:00
1 parent f7a9550363
commit f2dfb1433a
1 file changed
+5 -5
@@ -120,9 +120,9 @@ public class OrmManager implements IOrmManager {
// 设置数据库账号密码 // 设置数据库账号密码
if (StringUtils.isNotBlank(hostConfig.getUser()) && StringUtils.isNotBlank(hostConfig.getPassword())) { if (StringUtils.isNotBlank(hostConfig.getUser()) && StringUtils.isNotBlank(hostConfig.getPassword())) {
var authSource = "admin"; var authSource = StringUtils.isEmpty(hostConfig.getAuthSource())
if (hostConfig.getAuthSource() != null) ? "admin"
authSource = hostConfig.getAuthSource(); : hostConfig.getAuthSource();
mongoBuilder.credential(MongoCredential.createCredential(hostConfig.getUser(), authSource, hostConfig.getPassword().toCharArray())); mongoBuilder.credential(MongoCredential.createCredential(hostConfig.getUser(), authSource, hostConfig.getPassword().toCharArray()));
} }
@@ -542,9 +542,9 @@ public class OrmManager implements IOrmManager {
} }
checkSubEntity(clazz, valueType); checkSubEntity(clazz, valueType);
} else if (ObjectId.class.isAssignableFrom(fieldType)){ } else if (ObjectId.class.isAssignableFrom(fieldType)) {
// do nothing // do nothing
}else { } else {
checkEntity(fieldType); checkEntity(fieldType);
} }
} }