db by tool 72/98572/1
authorZhangZihao <zhangzihao@chinamobile.com>
Tue, 19 Nov 2019 02:58:53 +0000 (10:58 +0800)
committerZhangZihao <zhangzihao@chinamobile.com>
Tue, 19 Nov 2019 02:59:07 +0000 (10:59 +0800)
Change-Id: Ice7559bf89b79a1cf284eb94e23140406d97b0df
Issue-ID: DCAEGEN2-1877
Signed-off-by: ZhangZihao <zhangzihao@chinamobile.com>
components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/DbController.java
components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/repository/DbTypeRepository.java

index c7ccff2..6d43300 100644 (file)
@@ -84,17 +84,20 @@ public class DbController {
                return retString;
        }
 
-    @GetMapping("/list/")
-    @ResponseBody
-    @ApiOperation(value="Get all databases by encrypt")
-    public List<DbConfig> dblistByEncrypt(@RequestParam boolean encrypt) throws IOException {
-        Iterable<Db> ret = dbRepository.findByEncrypt(encrypt);
-        List<DbConfig> retDbConfig = new ArrayList<>();
-        for(Db db : ret) {
-            retDbConfig.add(db.getDbConfig());
-        }
-        return retDbConfig;
-    }
+       @GetMapping("/list")
+       @ResponseBody
+       @ApiOperation(value="Get all dbs by tool")
+       public List<DbConfig> dblistByTool(@RequestParam boolean tool) {
+               log.info("Search dbs by tool start......");
+               Iterable<DbType> dbType  = dbTypeRepository.findByTool(tool);
+               List<DbConfig> retDbConfig = new ArrayList<>();
+               for (DbType item : dbType) {
+                       for (Db d : item.getDbs()) {
+                               retDbConfig.add(d.getDbConfig());
+                       }
+               }
+               return retDbConfig;
+       }
 
        @GetMapping("/idAndName/{id}")
        @ResponseBody