|
@@ -8,10 +8,7 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.generator.domain.Community.*;
|
|
|
import com.ruoyi.generator.mapper.community.*;
|
|
|
-import com.ruoyi.generator.vo.CommunityArticleVo;
|
|
|
-import com.ruoyi.generator.vo.CommunityCircleVo;
|
|
|
-import com.ruoyi.generator.vo.CommunityUserInfoVo;
|
|
|
-import com.ruoyi.generator.vo.CommunityUserLikeVo;
|
|
|
+import com.ruoyi.generator.vo.*;
|
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -93,6 +90,9 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
@Autowired
|
|
|
private CommunityArticleRecommendMapper recommendMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommunityUserNotificationMapper communityUserNotificationMapper;
|
|
|
+
|
|
|
// @Override
|
|
|
// public List<CommunityArticleVo> selectCommunityArticleList(CommunityArticle communityArticle, int pageNum, int pageSize, int searchType) {
|
|
|
// Long userId = SecurityUtils.getUserId();
|
|
@@ -763,6 +763,45 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
return communityUserLikeVos;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取通知权限
|
|
|
+ * @param userId
|
|
|
+ * @return 获取通知权限
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<CommunityUserNotificationVo> selectUserNotification(Long userId) {
|
|
|
+ // 查询自己的通知权限
|
|
|
+ List<CommunityUserNotification> communityUserNotifications
|
|
|
+ = communityUserNotificationMapper
|
|
|
+ .selectList(new QueryWrapper<CommunityUserNotification>().eq("user_id", userId));
|
|
|
+
|
|
|
+ // 创建一个用于存放VO的列表
|
|
|
+ List<CommunityUserNotificationVo> communityUserNotificationVos = new ArrayList<>();
|
|
|
+
|
|
|
+ // 遍历查询结果,复制属性到 VO 对象
|
|
|
+ for (CommunityUserNotification communityUserNotification : communityUserNotifications) {
|
|
|
+ CommunityUserNotificationVo communityUserNotificationVo = new CommunityUserNotificationVo();
|
|
|
+ BeanUtils.copyProperties(communityUserNotification, communityUserNotificationVo);
|
|
|
+ communityUserNotificationVos.add(communityUserNotificationVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断通知权限是否为空
|
|
|
+ if (communityUserNotificationVos.isEmpty()) {
|
|
|
+ // 如果没有通知权限,插入一条关于 userId 的数据
|
|
|
+ CommunityUserNotification newNotification = new CommunityUserNotification();
|
|
|
+ newNotification.setUserId(userId);
|
|
|
+ // 设置其他必要的默认值,例如:
|
|
|
+ // 使用 MyBatis-Plus 执行插入操作
|
|
|
+ communityUserNotificationMapper.insert(newNotification);
|
|
|
+ // 将新插入的记录转换为 VO 并返回
|
|
|
+ CommunityUserNotificationVo newNotificationVo = new CommunityUserNotificationVo();
|
|
|
+ BeanUtils.copyProperties(newNotification, newNotificationVo);
|
|
|
+ communityUserNotificationVos.add(newNotificationVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return communityUserNotificationVos;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 判断是否是视频文件
|
|
|
*
|