use of com.moxi.mogublog.commons.entity.PictureSort in project mogu_blog_v2 by moxi624.
the class PictureSortServiceImpl method deletePictureSort.
@Override
public String deletePictureSort(PictureSortVO pictureSortVO) {
// 判断要删除的分类,是否有图片
QueryWrapper<Picture> pictureQueryWrapper = new QueryWrapper<>();
pictureQueryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE);
pictureQueryWrapper.eq(SQLConf.PICTURE_SORT_UID, pictureSortVO.getUid());
Integer pictureCount = pictureService.count(pictureQueryWrapper);
if (pictureCount > 0) {
return ResultUtil.errorWithMessage(MessageConf.PICTURE_UNDER_THIS_SORT);
}
PictureSort pictureSort = pictureSortService.getById(pictureSortVO.getUid());
pictureSort.setStatus(EStatus.DISABLED);
pictureSort.setUpdateTime(new Date());
pictureSort.updateById();
return ResultUtil.successWithMessage(MessageConf.DELETE_SUCCESS);
}
use of com.moxi.mogublog.commons.entity.PictureSort in project mogu_blog_v2 by moxi624.
the class PictureSortRestApi method getPictureSortByUid.
@OperationLogger(value = "通过Uid获取分类")
@ApiOperation(value = "通过Uid获取分类", notes = "通过Uid获取分类", response = String.class)
@PostMapping("/getPictureSortByUid")
public String getPictureSortByUid(@Validated({ Delete.class }) @RequestBody PictureSortVO pictureSortVO, BindingResult result) {
// 参数校验
ThrowableUtils.checkParamArgument(result);
PictureSort pictureSort = pictureSortService.getById(pictureSortVO.getUid());
log.info("通过Uid获取分类: {}", pictureSort);
return ResultUtil.successWithData(pictureSort);
}
Aggregations