*/
public String addTopic(String parentTopicid, String topicName, String topicNav, String user)
throws Exception {
String parentTree = "";
if (!StringUtils.isEmpty(parentTopicid)) {
Topic parentTopic = topicDAO.queryTopicById(parentTopicid);
if (parentTopic == null) {
logger.error(parentTopicid + "增加子栏目,父栏目" + parentTopicid + "不存在");
throw new Exception(parentTopicid + "栏目不存在");
}
parentTree = parentTopic.getTopicTree();
}
String topicid = JCMSConstant.createTopicId();
String topicTree = parentTree + topicid + ";";
Topic topic = new Topic();
topic.setTopicId(topicid);
topic.setTopicTree(topicTree);
topic.setModifyUser(user);
topic.setTopicName(topicName);
topic.setParentTopic(parentTopicid);
topic.setTopicNav(topicNav);
int num = topicDAO.insertTopic(topic);
if (num == 0) {
throw new Exception(parentTopicid + "增加子栏目失败");
}
return topicid;