Search in sources :

Example 6 with PictureSort

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);
}
Also used : PictureSort(com.moxi.mogublog.commons.entity.PictureSort) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) Picture(com.moxi.mogublog.commons.entity.Picture)

Example 7 with PictureSort

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);
}
Also used : PictureSort(com.moxi.mogublog.commons.entity.PictureSort) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation) OperationLogger(com.moxi.mogublog.admin.annotion.OperationLogger.OperationLogger)

Aggregations

PictureSort (com.moxi.mogublog.commons.entity.PictureSort)7 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)3 IPage (com.baomidou.mybatisplus.core.metadata.IPage)2 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)2 Picture (com.moxi.mogublog.commons.entity.Picture)2 OperationLogger (com.moxi.mogublog.admin.annotion.OperationLogger.OperationLogger)1 ApiOperation (io.swagger.annotations.ApiOperation)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1