| | |
| | | filmWorksMapper.updateById(filmWork); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void changeTopState(Long id) { |
| | | FilmWorks filmWork = filmWorksMapper.selectById(id); |
| | | if (filmWork == null) { |
| | | throw new ValidationException("找不到id为" + id + "的公告"); |
| | | } |
| | | if (Constants.COMMON_PUBLISH_STATUS.unpublished.name().equals(filmWork.getStatus())) { |
| | | throw new ValidationException("未发布作品不能置顶,请先发布"); |
| | | } |
| | | |
| | | FilmWorks filmWorkTop = filmWorksMapper.getTopStickyWeight(); |
| | | if (!ObjectUtils.isEmpty(filmWorkTop)) { |
| | | filmWork.setStickyWeight(filmWorkTop.getStickyWeight() + 100); |
| | | } else { |
| | | filmWork.setStickyWeight(100); |
| | | } |
| | | filmWorksMapper.updateById(filmWork); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void changeDownState(Long id) { |
| | | FilmWorks filmWork = filmWorksMapper.selectById(id); |
| | | if (filmWork == null) { |
| | | throw new ValidationException("找不到id为" + id + "的公告"); |
| | | } |
| | | if (Constants.COMMON_PUBLISH_STATUS.unpublished.name().equals(filmWork.getStatus())) { |
| | | throw new ValidationException("未发布作品无需清除权重"); |
| | | } |
| | | filmWork.setStickyWeight(0); |
| | | filmWorksMapper.updateById(filmWork); |
| | | } |
| | | |
| | | @Override |
| | | public void batchDelete(BatchDTO dto) { |
| | | filmWorksMapper.deleteBatchIds(dto.getIds()); |