use of org.neusoft.neubbs.entity.TopicCategoryDO in project neubbs by nuitcoder.
the class TopicServiceImpl method alterTopicContent.
@Override
public void alterTopicContent(int topicId, String newCategoryNick, String newTitle, String newTopicContent) {
this.getTopicNotNull(topicId);
this.getTopicContentNotNull(topicId);
TopicCategoryDO category = this.getTopicCategoryNotNullByNick(newCategoryNick);
// update forum_topic 'fucg_id', 'ft_title'
if (topicDAO.updateCategoryById(topicId, category.getId()) == 0 || topicDAO.updateTitleById(topicId, newTitle) == 0) {
throw new ServiceException(ApiMessage.DATABASE_EXCEPTION).log(LogWarnEnum.TS7);
}
// update forum_topic_content 'ftc_content'
if (topicContentDAO.updateContentByTopicId(topicId, newTopicContent) == 0) {
throw new ServiceException(ApiMessage.DATABASE_EXCEPTION).log(LogWarnEnum.TS8);
}
}
use of org.neusoft.neubbs.entity.TopicCategoryDO in project neubbs by nuitcoder.
the class TopicCategoryDAOTest method testListAllTopicCategory.
/**
* 测试获取所有话题分类
*/
@Test
@Transactional
public void testListAllTopicCategory() {
this.savaTestTopicCategoryDOToDatabase();
List<TopicCategoryDO> categoryList = topicCategoryDAO.listAllTopicCategory();
Assert.assertTrue(categoryList.size() >= 1);
int categoryCount = 1;
for (TopicCategoryDO topicCategory : categoryList) {
System.out.println("output topic category information ( No." + (categoryCount++) + " records):" + JsonUtil.toJsonString(topicCategory));
}
System.out.println("get all category list success!");
}
use of org.neusoft.neubbs.entity.TopicCategoryDO in project neubbs by nuitcoder.
the class TopicCategoryDAOTest method savaTestTopicCategoryDOToDatabase.
/**
* 保存话题分类至数据库
*
* @return TopicContent 数据库保存后,重新查询的话题分类
*/
private TopicCategoryDO savaTestTopicCategoryDOToDatabase() {
// build TopicCategoryDO, sava database
TopicCategoryDO category = new TopicCategoryDO();
category.setNick("testCategory");
category.setName("测试分类");
Assert.assertEquals(1, topicCategoryDAO.saveTopicCategory(category));
return topicCategoryDAO.getTopicCategoryById(category.getId());
}
use of org.neusoft.neubbs.entity.TopicCategoryDO in project neubbs by nuitcoder.
the class TopicCategoryDAOTest method testUpdateDescriptionByNick.
/**
* 测试修改话题分类描述
*/
@Test
@Transactional
public void testUpdateDescriptionByNick() {
TopicCategoryDO category = this.savaTestTopicCategoryDOToDatabase();
String newDescription = "this is new category description";
Assert.assertEquals(1, topicCategoryDAO.updateDescriptionByNick(category.getNick(), newDescription));
Assert.assertEquals(newDescription, topicCategoryDAO.getTopicCategoryById(category.getId()).getDescription());
System.out.println("update categoryNick=" + category.getNick() + " category description=<" + newDescription + ">");
}
use of org.neusoft.neubbs.entity.TopicCategoryDO in project neubbs by nuitcoder.
the class TopicCategoryDAOTest method testSaveTopicCategory.
/**
* 测试保存保存话题分类
*/
@Test
@Transactional
public void testSaveTopicCategory() {
TopicCategoryDO category = this.savaTestTopicCategoryDOToDatabase();
System.out.println("insert topic category information: " + category);
}
Aggregations