|
@@ -88,6 +88,9 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
//找出板块下的分类
|
|
|
Long classId = communityArticle.getClassId();
|
|
|
Long id = communityArticle.getId();
|
|
|
+ Long circleId = communityArticle.getCircleId();
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ List<CommunityArticleVo> communityArticleVos = null;
|
|
|
if (Objects.nonNull(id)) {
|
|
|
//获取指定文章详细内容,文章浏览量+1
|
|
|
CommunityArticle article = communityArticleMapper.selectById(id);
|
|
@@ -95,9 +98,8 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
communityArticleMapper.updateById(article);
|
|
|
}
|
|
|
|
|
|
- Long userId = SecurityUtils.getUserId();
|
|
|
List<Long> circleIds = null;
|
|
|
- if (!Objects.isNull(classId)) {
|
|
|
+ if (Objects.nonNull(classId)) {
|
|
|
List<CommunityClassCircle> classCircles = communityClassCircleMapper.selectList(new QueryWrapper<CommunityClassCircle>().eq("class_id", classId));
|
|
|
circleIds = new ArrayList<>();
|
|
|
for (CommunityClassCircle classCircle : classCircles) {
|
|
@@ -105,9 +107,21 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //如果有圈子id,则按照传递的圈子id取文章数据
|
|
|
+ if (Objects.nonNull(circleId)) {
|
|
|
+ circleIds = new ArrayList<>();
|
|
|
+ circleIds.add(circleId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果没有圈子,则返回null数据
|
|
|
+ if (Objects.isNull(circleIds) || circleIds.isEmpty()) {
|
|
|
+ communityArticleVos = new ArrayList<>();
|
|
|
+ return communityArticleVos;
|
|
|
+ }
|
|
|
+
|
|
|
//根据分类查找文章
|
|
|
int offset = (pageNum - 1) * pageSize;
|
|
|
- List<CommunityArticleVo> communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, circleIds, offset, pageSize);
|
|
|
+ communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, circleIds, offset, pageSize);
|
|
|
for (CommunityArticleVo articleVo : communityArticleVos) {
|
|
|
List<Map<String, Object>> imageList = articleVo.getImageList();
|
|
|
List<CommunityArticleImages> videoList = new ArrayList<>();
|
|
@@ -218,6 +232,13 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
tagLog.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
tagLog.setCreateBy(userId);
|
|
|
articleTagMapper.insert(tagLog);
|
|
|
+
|
|
|
+ //标签热度自增
|
|
|
+ CommunityTag communityTag = communityTagMapper.selectById(tag.getId());
|
|
|
+ communityTag.setTagHot(Objects.isNull(communityTag.getTagHot()) ? 1 : communityTag.getTagHot() + 1);
|
|
|
+ communityTag.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
+ communityTag.setUpdateBy(userId);
|
|
|
+ communityTagMapper.updateById(communityTag);
|
|
|
}
|
|
|
|
|
|
//插入图片日志
|