Browse Source

REPORT-133863 【fr-fbp回归】数据字典获取数据库字段空白

fbp/release
Destiny.Lin 3 months ago
parent
commit
b9b7bd89f7
  1. 7
      designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java
  2. 4
      designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java

7
designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

@ -6,6 +6,7 @@ import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.Dialect; import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.impl.Connection;
import com.fr.data.impl.DatabaseDictionary; import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
@ -25,6 +26,7 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -176,8 +178,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
if (StringUtils.isBlank(para.getDatabaseName())) { if (StringUtils.isBlank(para.getDatabaseName())) {
dbDict.setDatabaseConnection(null); dbDict.setDatabaseConnection(null);
} else { } else {
database = DBUtils.checkDBConnection(para.getDatabaseName()); Connection connection = ConnectionRepository.getInstance().getByName(para.getDatabaseName()).getConnection();
if (database != null) { if (connection != null) {
database = new NameDatabaseConnection(para.getDatabaseName());
dbDict.setDatabaseConnection(database); dbDict.setDatabaseConnection(database);
} }
} }

4
designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java

@ -7,6 +7,8 @@ import com.fr.file.ConnectionConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerAdaptor; import com.fr.transaction.WorkerAdaptor;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -106,7 +108,7 @@ public class ConnectionConfigWrapper implements ConnectionConfigProvider, Connec
@Override @Override
public @Nullable Connection getConnection(@NotNull String connectionName) { public @Nullable Connection getConnection(@NotNull String connectionName) {
Connection connection = ConnectionConfig.getInstance().getConnection(connectionName); Connection connection = WorkContext.getCurrent().isLocal() ? ConnectionConfig.getInstance().getConnection(connectionName) : ConnectionRepository.getInstance().getByName(connectionName).getConnection();
if (connection != null) { if (connection != null) {
connection.setConnectionName(connectionName); connection.setConnectionName(connectionName);
} }

Loading…
Cancel
Save