Search in sources :

Example 6 with BlogCategory

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);
}
Also used : BlogCategory(com.duan.blogos.entity.blog.BlogCategory) BloggerCategoryDTO(com.duan.blogos.dto.blogger.BloggerCategoryDTO) ArrayList(java.util.ArrayList) ResultBean(com.duan.blogos.restful.ResultBean)

Example 7 with BlogCategory

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;
}
Also used : BlogCategory(com.duan.blogos.entity.blog.BlogCategory)

Aggregations

BlogCategory (com.duan.blogos.entity.blog.BlogCategory)7 Blog (com.duan.blogos.entity.blog.Blog)4 ResultBean (com.duan.blogos.restful.ResultBean)4 BlogLabel (com.duan.blogos.entity.blog.BlogLabel)2 BlogStatistics (com.duan.blogos.entity.blog.BlogStatistics)2 ArrayList (java.util.ArrayList)2 BlogListItemDTO (com.duan.blogos.dto.blog.BlogListItemDTO)1 BlogMainContentDTO (com.duan.blogos.dto.blog.BlogMainContentDTO)1 BlogListItemDTO (com.duan.blogos.dto.blogger.BlogListItemDTO)1 BloggerCategoryDTO (com.duan.blogos.dto.blogger.BloggerCategoryDTO)1 SQLException (com.duan.blogos.exception.internal.SQLException)1