use of cn.exrick.manager.pojo.TbContentCategory in project xmall by Exrick.
the class ContentCatServiceImpl method addContentCat.
@Override
public int addContentCat(ContentCatDto contentCatDto) {
TbContentCategory tbContentCategory = DtoUtil.ContentCatDto2TbContentCategory(contentCatDto);
tbContentCategory.setParentId((long) 0);
tbContentCategory.setCreated(new Date());
tbContentCategory.setUpdated(new Date());
if (tbContentCategoryMapper.insert(tbContentCategory) != 1) {
throw new XmallException("添加内容分类失败");
}
// 同步缓存
deleteHomeRedis();
return 1;
}
use of cn.exrick.manager.pojo.TbContentCategory in project xmall by Exrick.
the class ContentImageServiceImpl method getContentImage.
@Override
public DataTablesResult getContentImage() {
DataTablesResult result = new DataTablesResult();
List<ImageDto> list = new ArrayList<>();
TbImageExample example = new TbImageExample();
List<TbImage> listImage = tbImageMapper.selectByExample(example);
for (int i = 0; i < listImage.size(); i++) {
ImageDto imageDto = DtoUtil.TbImage2ImageDto(listImage.get(i));
TbContentCategory tbContentCategory = tbContentCategoryMapper.selectByPrimaryKey(Long.valueOf(listImage.get(i).getCategoryId()));
imageDto.setCategory(tbContentCategory.getName());
list.add(imageDto);
}
result.setData(list);
return result;
}
use of cn.exrick.manager.pojo.TbContentCategory in project xmall by Exrick.
the class ContentCatServiceImpl method getContentCatList.
@Override
public List<ZTreeNode> getContentCatList(Long parentId) {
TbContentCategoryExample example = new TbContentCategoryExample();
TbContentCategoryExample.Criteria criteria = example.createCriteria();
criteria.andParentIdEqualTo(parentId);
example.setOrderByClause("sort_order");
List<TbContentCategory> catList = tbContentCategoryMapper.selectByExample(example);
List<ZTreeNode> list = new ArrayList<>();
for (int i = 0; i < catList.size(); i++) {
ZTreeNode zTreeNode = DtoUtil.TbContentCategory2ZTreeNode(catList.get(i));
list.add(zTreeNode);
}
return list;
}
use of cn.exrick.manager.pojo.TbContentCategory in project xmall by Exrick.
the class ContentCatServiceImpl method updateContentCat.
@Override
public int updateContentCat(ContentCatDto contentCatDto) {
TbContentCategory tbContentCategory = DtoUtil.ContentCatDto2TbContentCategory(contentCatDto);
TbContentCategory old = getContentCatById(tbContentCategory.getId());
tbContentCategory.setParentId(old.getParentId());
tbContentCategory.setIcon(old.getIcon());
tbContentCategory.setCreated(old.getCreated());
tbContentCategory.setUpdated(new Date());
if (tbContentCategoryMapper.updateByPrimaryKey(tbContentCategory) != 1) {
throw new XmallException("更新内容分类失败");
}
// 同步缓存
deleteHomeRedis();
return 1;
}
Aggregations