* ============LICENSE_START=======================================================\r
 * ONAP : DATALAKE\r
 * ================================================================================\r
-* Copyright 2019 China Mobile\r
+* Copyright 2019-2020 China Mobile\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r
 \r
 CREATE TABLE `topic` (\r
-  `id` int(11) NOT NULL,\r
+  `id` int(11) NOT NULL AUTO_INCREMENT,\r
   `aggregate_array_path` varchar(255) DEFAULT NULL,\r
   `correlate_cleared_message` bit(1) NOT NULL DEFAULT b'0',\r
   `data_format` varchar(255) DEFAULT NULL,\r
 
--- /dev/null
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : DataLake
+ * ================================================================================
+ * Copyright 2019-2020 China Mobile
+ *=================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.datalake.feeder.controller;
+
+import io.swagger.annotations.ApiOperation;
+import org.onap.datalake.feeder.domain.TopicName;
+import org.onap.datalake.feeder.repository.TopicNameRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping(value = "/topicNames", produces = { MediaType.APPLICATION_JSON_VALUE })
+public class TopicNameController {
+
+    @Autowired
+    private TopicNameRepository topicNameRepository;
+
+    @GetMapping("")
+    @ResponseBody
+    @ApiOperation(value="List all topicNames")
+    public List<String> list() {
+        Iterable<TopicName> ret = topicNameRepository.findAll();
+        List<String> retString = new ArrayList<>();
+        for(TopicName item : ret) {
+                retString.add(item.getId());
+        }
+        return retString;
+    }
+}
 
 * ============LICENSE_START=======================================================
 * ONAP : DataLake
 * ================================================================================
-* Copyright 2019 China Mobile
+* Copyright 2019-2020 China Mobile
 *=================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.ManyToMany;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
 
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONObject;
 public class Topic {
        @Id
     @Column(name = "`id`")
+       @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Integer id;
 
        @ManyToOne(fetch = FetchType.EAGER)
                Set<Db> topicDb = getDbs();
                List<Integer> dbList = new ArrayList<>();
                List<Integer> enabledDbList = new ArrayList<>();
+               List<String> enabledDbList2 = new ArrayList<>();
                if (topicDb != null) {
                        for (Db item : topicDb) {
                                dbList.add(item.getId());
                                if(item.isEnabled()) {
                                        enabledDbList.add(item.getId());
+                                       enabledDbList2.add(item.getDbType().getId());
                                }
                        }
                }
                tConfig.setSinkdbs(dbList);
                tConfig.setEnabledSinkdbs(enabledDbList);
+               Map<String,Integer> map = new HashMap<>();
+               for (String string : enabledDbList2) {
+                       if(map.containsKey(string)) {
+                               map.put(string, map.get(string).intValue()+1);
+                       }else {
+                               map.put(string, new Integer(1));
+                       }
+               }
+               tConfig.setCountsDb(map);
 
                Set<Kafka> topicKafka = getKafkas();
                List<Integer> kafkaList = new ArrayList<>();
                        }
                }
                tConfig.setKafkas(kafkaList);
+               tConfig.setCountsKafka(kafkaList.size());
                return tConfig;
        }
 
 
  * ============LICENSE_START=======================================================
  * ONAP : DataLake
  * ================================================================================
- * Copyright 2019 QCT
+ * Copyright 2019-2020 QCT
  *=================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 import lombok.Setter;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * JSON request body for Topic manipulation.
 
 public class TopicConfig {
 
-       private int id;
+       private Integer id;
        private String name;
        private String login;
        private String password;
        private String aggregateArrayPath;
        private String flattenArrayPath;
        private List<Integer> kafkas;
-       
+       private Map<String,Integer> countsDb;
+       private int countsKafka;
+
        @Override
        public String toString() {
                return String.format("TopicConfig %s(enabled=%s, enabledSinkdbs=%s)", name, enabled, enabledSinkdbs);
 
 * ============LICENSE_START=======================================================
 * ONAP : DATALAKE
 * ================================================================================
-* Copyright 2019 China Mobile
+* Copyright 2019-2020 China Mobile
 *=================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 import org.onap.datalake.feeder.domain.EffectiveTopic;
 import org.onap.datalake.feeder.domain.Kafka;
 import org.onap.datalake.feeder.domain.Topic;
+import org.onap.datalake.feeder.domain.TopicName;
 import org.onap.datalake.feeder.repository.DbRepository;
 import org.onap.datalake.feeder.repository.KafkaRepository;
 import org.onap.datalake.feeder.repository.TopicNameRepository;
        private void fillTopic(TopicConfig tConfig, Topic topic) {
                Set<Db> relateDb = new HashSet<>();
                topic.setId(tConfig.getId());
-               topic.setTopicName(topicNameRepository.findById(tConfig.getName()).get());
+               Optional<TopicName> t = topicNameRepository.findById(tConfig.getName());
+               if (!t.isPresent())
+                       throw new IllegalArgumentException("Can not find topicName in TopicName, topic name " + tConfig.getName());
+               topic.setTopicName(t.get());
                topic.setLogin(tConfig.getLogin());
                topic.setPass(tConfig.getPassword());
                topic.setEnabled(tConfig.isEnabled());