zhoupeng před 1 rokem
rodič
revize
f08f3209b6

+ 19 - 4
cqcy-ei/cqcy-ei-da/src/main/java/com/example/opc_da/controller/DataSourceController.java

@@ -122,16 +122,17 @@ public class DataSourceController {
 
     /**
      * 获取复合筛选结构复合筛选
-     * @param id 数据源id
+     *
+     * @param id            数据源id
      * @param chooseItemStr 所选节点路径字符串
-     * @param nextItemStr 下级所输关键字
-     * @param needItemStr 需要的节点字符串
+     * @param nextItemStr   下级所输关键字
+     * @param needItemStr   需要的节点字符串
      * @return
      */
     @GetMapping("/getCompositeScreen")
     public Result getCompositeScreen(Integer id, String chooseItemStr, String nextItemStr, String needItemStr) {
         if (Blank.isEmpty(id, nextItemStr, needItemStr)) {
-            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据源不能为空");
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
         return dataSourceService.getCompositeScreen(id, chooseItemStr, nextItemStr, needItemStr);
     }
@@ -230,4 +231,18 @@ public class DataSourceController {
         return dataSourceService.delDataSourceDriver(id);
     }
 
+    /**
+     * 通过数据源id获取,此驱动配置下面的数据项信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getDriverItemBySouceId")
+    public Result getDriverItemBySouceId(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataSourceService.getDriverItemBySouceId(id);
+    }
+
 }

+ 2 - 0
cqcy-ei/cqcy-ei-da/src/main/java/com/example/opc_da/service/DataSourceService.java

@@ -35,4 +35,6 @@ public interface DataSourceService {
     Result getDataSourceDriverByid(Integer id);
 
     Result getCompositeScreen(Integer id, String chooseItemStr, String nextItemStr, String needItemStr);
+
+    Result getDriverItemBySouceId(Integer id);
 }

+ 9 - 0
cqcy-ei/cqcy-ei-da/src/main/java/com/example/opc_da/service/impl/DataSourceServiceImpl.java

@@ -216,6 +216,15 @@ public class DataSourceServiceImpl implements DataSourceService {
     }
 
     @Override
+    public Result getDriverItemBySouceId(Integer id) {
+        DataSource dataSource = dataSourceDao.getDataSourceById(id);
+        String clsId = dataSource.getClsId();
+        DataSourceDriver dataSourceDriver = dataSourceDao.getDataSourceDriverByclsId(clsId);
+        Integer dataSourceDriverId = dataSourceDriver.getId();
+        return Result.ok(dataSourceDao.getDbItemByDid(dataSourceDriverId));
+    }
+
+    @Override
     public Result getAllDataSouceCls() {
         List<DataSource> dataSourceList = dataSourceDao.getDataSourceClsId();
         if (Blank.isNotEmpty(dataSourceList)) {