use of cn.exrick.manager.pojo.TbImage 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.TbImage in project xmall by Exrick.
the class ContentImageServiceImpl method updateContentImage.
@Override
public int updateContentImage(TbImage tbImage) {
TbImage old = getContentImageById(Long.valueOf(tbImage.getId()));
if (tbImage.getImage().isEmpty()) {
tbImage.setImage(old.getImage());
}
tbImage.setUpdated(new Date());
tbImage.setImageMobile(old.getImageMobile());
tbImage.setCreated(old.getCreated());
if (tbImageMapper.updateByPrimaryKey(tbImage) != 1) {
throw new XmallException("更新图片失败");
}
// 同步缓存
deleteHomeRedis();
return 1;
}
Aggregations