Selaa lähdekoodia

fix:达梦查询所有库信息

xuezizhuo 1 vuosi sitten
vanhempi
säilyke
d9201e38be

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SqlInterceptor.java

@@ -52,7 +52,7 @@ public class SqlInterceptor implements Interceptor {
         try {
             SecurityUtils.getDatabaseType();
         } catch (Exception e) {
-            return "";
+            return sql;
         }
         if (SecurityUtils.getDatabaseType().equals("sqlserver"))
             return "USE `" + SecurityUtils.getDatabaseName() + "`; ";

+ 1 - 1
zkqy-datamodeling/src/main/java/com/zkqy/datamodeling/service/impl/DataSourceServiceImpl.java

@@ -45,7 +45,7 @@ public class DataSourceServiceImpl implements IDataSourceService {
                 retList = dataSourceMapper.querySelectDatasource("select name from sys.databases;");
                 break;
             case "dm":
-                retList = dataSourceMapper.querySelectDatasource("SELECT * FROM all_users;");
+                retList = dataSourceMapper.querySelectDatasource("select   a.name schename from SYS.SYSOBJECTS a, SYS.SYSOBJECTS b where a.\"TYPE$\"='SCH' and a.pid=b.id;");
                 break;
             case "oracle":
                 retList = dataSourceMapper.querySelectDatasource("SELECT DISTINCT object_name FROM ALL_OBJECTS WHERE OBJECT_TYPE = 'SCH';");

+ 5 - 0
zkqy-datamodeling/src/main/java/com/zkqy/datamodeling/service/impl/TableInfoServiceImpl.java

@@ -133,6 +133,11 @@ public class TableInfoServiceImpl implements ITableInfoService {
         String databaseType = (String) map.get("databaseType");
         String databaseName = (String) map.get("databaseName");
         String username = (String) map.get("username");
+
+        if(!StringUtils.hasLength(databaseType)){
+            return AjaxResult.error("当前用户没有数据源,无法查看该页面");
+        }
+
         //获取数据源信息
 //        if(redisTemplate.hasKey("DataSource")){
 //            DataSource dataSource =JSON.parseObject(redisTemplate.opsForValue().get("DataSource").toString(),DataSource.class);