use of com.duan.blogos.entity.blog.BlogCategory in project BlogSystem by DuanJiaNing.
the class BloggerCategoryServiceImpl method listBlogCategory.
@Override
public ResultBean<List<BloggerCategoryDTO>> listBlogCategory(int bloggerId, int offset, int rows) {
List<BlogCategory> categories = categoryDao.listCategoryByBloggerId(bloggerId, offset, rows);
if (CollectionUtils.isEmpty(categories))
return null;
List<BloggerCategoryDTO> result = new ArrayList<>();
for (BlogCategory category : categories) {
result.add(getBloggerCategoryDTO(bloggerId, category));
}
return new ResultBean<>(result);
}
use of com.duan.blogos.entity.blog.BlogCategory in project BlogSystem by DuanJiaNing.
the class BloggerCategoryServiceImpl method updateBlogCategory.
@Override
public boolean updateBlogCategory(int bloggerId, int categoryId, int newIconId, String newTitle, String newBewrite) {
BlogCategory category = categoryDao.getCategory(bloggerId, categoryId);
Integer oldIconId = category.getIconId();
if (!StringUtils.isEmpty(newTitle))
category.setTitle(newTitle);
if (!StringUtils.isEmpty(newBewrite))
category.setBewrite(newBewrite);
if (newIconId > 0)
category.setIconId(newIconId);
category.setId(categoryId);
int effect = categoryDao.update(category);
if (effect <= 0)
return false;
// 修改图片可见性,引用次数
imageManager.imageUpdateHandle(bloggerId, newIconId, oldIconId);
return true;
}
Aggregations