| | |
| | | Integer status) { |
| | | LambdaQueryWrapper<HealthPopularization> qw = new LambdaQueryWrapper<HealthPopularization>() |
| | | .eq(HealthPopularization::getDeleted, 0) |
| | | .orderByAsc(HealthPopularization::getSort) |
| | | .orderByDesc(HealthPopularization::getSort) |
| | | .orderByDesc(HealthPopularization::getId); |
| | | String trimmedKeyword = trimToNull(keyword); |
| | | if (trimmedKeyword != null) { |
| | |
| | | return toDetailVO(requireItem(id)); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public HealthPopularizationDetailVO create(HealthPopularizationSaveRequest req) { |
| | | HealthPopularization item = new HealthPopularization(); |
| | | fillEntity(item, req); |
| | | item.setClickCount(0); |
| | | item.setSort(0); |
| | | item.setDeleted(0); |
| | | healthPopularizationMapper.insert(item); |
| | | return detail(item.getId()); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public HealthPopularizationDetailVO update(Long id, HealthPopularizationSaveRequest req) { |
| | | HealthPopularization item = requireItem(id); |
| | | fillEntity(item, req); |
| | |
| | | return detail(id); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delete(Long id) { |
| | | requireItem(id); |
| | | healthPopularizationMapper.deleteById(id); |
| | |
| | | item.setContentType(contentType); |
| | | item.setStatus(req.getStatus()); |
| | | item.setIsHomeRecommend(req.getIsHomeRecommend()); |
| | | item.setSort(req.getSort()); |
| | | if (contentType == HealthPopularization.CONTENT_TYPE_ARTICLE) { |
| | | String content = trimToNull(req.getContent()); |
| | | if (content == null) { |
| | |
| | | item.setContent(content); |
| | | item.setVideoUrl(null); |
| | | item.setVideoFileName(null); |
| | | item.setVideoDescription(null); |
| | | return; |
| | | } |
| | | |
| | |
| | | item.setContent(null); |
| | | item.setVideoUrl(videoUrl); |
| | | item.setVideoFileName(trimToNull(req.getVideoFileName())); |
| | | item.setVideoDescription(trimToNull(req.getVideoDescription())); |
| | | } |
| | | |
| | | private int validateContentType(Integer contentType) { |
| | |
| | | vo.setTitle(item.getTitle()); |
| | | vo.setCoverImg(item.getCoverImg()); |
| | | vo.setClickCount(defaultNumber(item.getClickCount())); |
| | | vo.setSort(defaultNumber(item.getSort())); |
| | | vo.setContentType(item.getContentType()); |
| | | vo.setStatus(item.getStatus()); |
| | | vo.setIsHomeRecommend(item.getIsHomeRecommend()); |
| | |
| | | vo.setContent(item.getContent()); |
| | | vo.setVideoUrl(item.getVideoUrl()); |
| | | vo.setVideoFileName(item.getVideoFileName()); |
| | | vo.setVideoDescription(item.getVideoDescription()); |
| | | vo.setStatus(item.getStatus()); |
| | | vo.setIsHomeRecommend(item.getIsHomeRecommend()); |
| | | vo.setClickCount(defaultNumber(item.getClickCount())); |