|
@@ -109,6 +109,8 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
@Autowired
|
|
|
private CommunityUserBlockMapper communityUserBlockMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommunityUserPromptMapper communityUserPromptMapper;
|
|
|
/**
|
|
|
* 查询文章列表
|
|
|
*
|
|
@@ -809,10 +811,49 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
return communityArticleMapper.selectTrendingTopByContent(content);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
- *
|
|
|
+ * 个人中心简介信息
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
*/
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public List<CommunityUserPromptVo> selectCommunityUserPrompt(Long userId) {
|
|
|
+ if (Objects.isNull(userId)) {
|
|
|
+ userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
+ }
|
|
|
+ // 查询自己的通知列表
|
|
|
+ List<CommunityUserPrompt> communityUserPrompts
|
|
|
+ = communityUserPromptMapper
|
|
|
+ .selectList(new QueryWrapper<CommunityUserPrompt>().eq("user_id", userId));
|
|
|
+
|
|
|
+ // 创建一个用于存放VO的列表
|
|
|
+ List<CommunityUserPromptVo> communityUserPromptVos = new ArrayList<>();
|
|
|
+ // 遍历查询结果,复制属性到 VO 对象
|
|
|
+ for (CommunityUserPrompt communityUserPrompt : communityUserPrompts) {
|
|
|
+ CommunityUserPromptVo communityUserPromptVo = new CommunityUserPromptVo();
|
|
|
+ BeanUtils.copyProperties(communityUserPrompt, communityUserPromptVo);
|
|
|
+ communityUserPromptVos.add(communityUserPromptVo);
|
|
|
+ }
|
|
|
+ // 判断隐私权限是否为空
|
|
|
+ if (communityUserPromptVos.isEmpty()) {
|
|
|
+ // 如果没有隐私权限,插入一条关于 userId 的数据
|
|
|
+ CommunityUserPrompt newPrompt = new CommunityUserPrompt();
|
|
|
+ newPrompt.setUserId(userId);
|
|
|
+ newPrompt.setLikeUser(false);
|
|
|
+ newPrompt.setCommentCircle(false);
|
|
|
+ newPrompt.setLikeCollect(false);
|
|
|
+ // 设置其他必要的默认值,例如:
|
|
|
+ // 使用 MyBatis-Plus 执行插入操作
|
|
|
+ communityUserPromptMapper.insert(newPrompt);
|
|
|
+ // 将新插入的记录转换为 VO 并返回
|
|
|
+ CommunityUserPromptVo newPromptVo = new CommunityUserPromptVo();
|
|
|
+ BeanUtils.copyProperties(newPrompt, newPromptVo);
|
|
|
+ communityUserPromptVos.add(newPromptVo);
|
|
|
+ }
|
|
|
+ return communityUserPromptVos;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 判断是否是视频文件
|