Ver código fonte

Merge remote-tracking branch 'origin/dev' into dev

fangqing 5 meses atrás
pai
commit
b7e7ac803e

+ 3 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java

@@ -189,8 +189,7 @@ public class SysLoginService {
         if (!smsCode.equalsIgnoreCase(code)) {
             throw new CaptchaException();       //抛出验证码错误的异常
         }
-        //成功  删除内存的验证码
-        redisCache.deleteObject(verifyKey);
+
         Authentication authentication = null; // 用户验证
         try {
             UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(phone, Constants.CUSTOM_LOGIN_SMS);
@@ -208,6 +207,8 @@ public class SysLoginService {
         }
         LoginUser loginUser = (LoginUser) authentication.getPrincipal();
         recordLoginInfo(loginUser.getUserId());                     //修改sys_user最近登录IP和登录时间
+        //成功  删除内存的验证码
+        redisCache.deleteObject(verifyKey);
         // 生成token
         return tokenService.createToken(loginUser);
     }

+ 48 - 28
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityArticleController.java

@@ -20,7 +20,6 @@ import com.ruoyi.generator.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.logging.log4j.util.Strings;
-import org.apache.poi.xssf.usermodel.XSSFPivotTable;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -85,7 +84,7 @@ public class CommunityArticleController extends BaseController {
     private CommunityCollectionMapper communityCollectionMapper;
 
     @Autowired
-    private  CommunityTagMapper communityTagMapper;
+    private CommunityTagMapper communityTagMapper;
 
     @Autowired
     private CommunityCircleExpandMapper communityCircleExpandMapper;
@@ -118,6 +117,7 @@ public class CommunityArticleController extends BaseController {
             rspData.setMsg("查询成功");
             rspData.setRows(list);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return rspData;
@@ -137,6 +137,7 @@ public class CommunityArticleController extends BaseController {
             }
             communityArticleService.insertCommunityArticle(communityArticle);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success("文章发布成功!");
@@ -161,6 +162,7 @@ public class CommunityArticleController extends BaseController {
                 return success("删除成功!");
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return error("删除失败!");
@@ -175,6 +177,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityClasses = communityClassMapper.selectList(new QueryWrapper<CommunityClass>());
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success(communityClasses);
@@ -196,22 +199,23 @@ public class CommunityArticleController extends BaseController {
                 oneObject.put("oneName", circleName);
                 oneObject.put("oneId", communityCircleExpand.getId());
                 JSONArray twoArray = new JSONArray();
-                List<CommunityCircle> classNameByCircleId = communityClassCircleMapper.getClassNameByCircleId(userId,id);
+                List<CommunityCircle> classNameByCircleId = communityClassCircleMapper.getClassNameByCircleId(userId, id);
                 // 将 List<CommunityCircle> 转换为 JSONArray
                 for (CommunityCircle communityCircle : classNameByCircleId) {
                     JSONObject twoObject = new JSONObject();
                     twoObject.put("twoId", communityCircle.getId());
                     twoObject.put("twoName", communityCircle.getCircleName());
                     twoObject.put("twoImg", communityCircle.getImageUrl());
-                    twoObject.put("isCare",communityCircle.getIsCare());
-                    twoObject.put("heat",communityCircle.getHeat());
+                    twoObject.put("isCare", communityCircle.getIsCare());
+                    twoObject.put("heat", communityCircle.getHeat());
                     twoArray.add(twoObject);
                 }
                 oneObject.put("one", twoArray);
                 sumArray.add(oneObject); // 添加到 sumArray
             }
         } catch (Exception e) {
-             throw new ProjectException();
+            System.out.println(e.getMessage());
+            throw new ProjectException();
         }
 
         return AjaxResult.success(sumArray);
@@ -236,6 +240,7 @@ public class CommunityArticleController extends BaseController {
             //新增评论
             communityArticleService.sendComment(communityArticleComment);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success();
@@ -254,6 +259,7 @@ public class CommunityArticleController extends BaseController {
             //删除评论
             communityArticleService.deleteComment(articleComment);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success();
@@ -293,6 +299,7 @@ public class CommunityArticleController extends BaseController {
                 return AjaxResult.error(message);
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -343,6 +350,7 @@ public class CommunityArticleController extends BaseController {
                 return AjaxResult.error(message);
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -381,6 +389,7 @@ public class CommunityArticleController extends BaseController {
                 return AjaxResult.error(message);
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -434,6 +443,7 @@ public class CommunityArticleController extends BaseController {
                 message = "取消点赞";
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -452,6 +462,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityCircles = communityArticleService.selectCommunityCircleList(classId);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success(communityCircles);
@@ -484,7 +495,7 @@ public class CommunityArticleController extends BaseController {
             }
 
             //为空返回空值
-            if (communityCircles == null){
+            if (communityCircles == null) {
                 return AjaxResult.success("圈子为空");
             }
 
@@ -500,6 +511,7 @@ public class CommunityArticleController extends BaseController {
 
 
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -546,6 +558,7 @@ public class CommunityArticleController extends BaseController {
                 msg = "已取关";
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -575,6 +588,7 @@ public class CommunityArticleController extends BaseController {
                 msg = "已关注";
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -591,6 +605,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityUserInfoVo = communityArticleService.selectCommunityUserInfoById(userId);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success(communityUserInfoVo);
@@ -623,6 +638,7 @@ public class CommunityArticleController extends BaseController {
             }
         } catch (Exception e) {
             // e.printStackTrace();
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -669,6 +685,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityUserLikeVos = communityArticleService.selectUserFansList(SecurityUtils.getLoginUser().getUserId());
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -682,6 +699,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityUserLikeVos = communityArticleService.selectMutualAttention(SecurityUtils.getLoginUser().getUserId());
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -717,6 +735,7 @@ public class CommunityArticleController extends BaseController {
             communityUserInfo.setBackImage(backImage);
             communityUserInfoMapper.updateById(communityUserInfo);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success("背景图片上传成功!");
@@ -742,13 +761,11 @@ public class CommunityArticleController extends BaseController {
 
         List<CommunityCollectionVo> communityCollectionVos = null;
         try {
-          communityCollectionVos = communityCollectionService.selectUserCollection(userId, articleId);
+            communityCollectionVos = communityCollectionService.selectUserCollection(userId, articleId);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
-
-
-
         return AjaxResult.success(communityCollectionVos);
     }
 
@@ -792,6 +809,7 @@ public class CommunityArticleController extends BaseController {
             communityCollection.setDelete(false);
             communityCollectionService.save(communityCollection);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -814,6 +832,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityCollectionService.deleteCollectionById(collectionId);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success("删除成功!");
@@ -900,6 +919,7 @@ public class CommunityArticleController extends BaseController {
             collectionArticle.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
             communityCollectionService.addArticleToCollection(collectionArticle);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -923,6 +943,7 @@ public class CommunityArticleController extends BaseController {
         try {
             communityCollectionService.deleteArticleToCollection(collectionId, articleId);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success("文章删除成功!");
@@ -936,15 +957,16 @@ public class CommunityArticleController extends BaseController {
      */
     @ApiOperation("查询用户合集")
     @GetMapping("/getCollection")
-    public AjaxResult getCollection(Long collectionId,Long  searchType) {
+    public AjaxResult getCollection(Long collectionId, Long searchType) {
         if (Objects.isNull(collectionId)) {
             return AjaxResult.error("合集不存在!");
         }
         List<CommunityCollectionArticleVo> collectionArticleVos = null;
         JSONArray jsonArray;
         try {
-           jsonArray = communityCollectionService.selectArticleInfoInCollection(collectionId,searchType);
+            jsonArray = communityCollectionService.selectArticleInfoInCollection(collectionId, searchType);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success(jsonArray);
@@ -952,6 +974,7 @@ public class CommunityArticleController extends BaseController {
 
     /**
      * 搜索关键字
+     *
      * @param content
      * @return 内容
      * fangqing
@@ -964,13 +987,15 @@ public class CommunityArticleController extends BaseController {
         try {
             trendingTops = communityArticleMapper.selectTrendingTopByContent(content);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
-        return AjaxResult.success("获取成功!",trendingTops);
+        return AjaxResult.success("获取成功!", trendingTops);
     }
 
     /**
      * 订阅/取订合集
+     *
      * @param collectionUser
      * @return 内容
      * fangqing
@@ -980,7 +1005,7 @@ public class CommunityArticleController extends BaseController {
     @Transactional
     //@Anonymous
     public AjaxResult subscribeCollection(@RequestBody CommunityCollectionUser collectionUser) {
-        if (Objects.isNull(collectionUser.getCollectionId()) ) {
+        if (Objects.isNull(collectionUser.getCollectionId())) {
             return AjaxResult.error("参数异常!");
         }
 
@@ -988,10 +1013,11 @@ public class CommunityArticleController extends BaseController {
         try {
             communityCollectionUser = communityCollectionUserService.subscribeCollection(collectionUser);
 
-            if (communityCollectionUser == null){
+            if (communityCollectionUser == null) {
                 return AjaxResult.success("不能关注自己创建的合集/传参有误");
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -1001,23 +1027,17 @@ public class CommunityArticleController extends BaseController {
 
     @ApiOperation("获取个人中心信息")
     @GetMapping("/userPrompt")
-    public AjaxResult userPrompt() {
+    public AjaxResult userPrompt(Long userId) {
 
-        Long  userId = SecurityUtils.getLoginUser().getUserId();
 
-        CommunityUserPrompt communityUserPrompt = null;
+        List<CommunityUserPromptVo> communityUserPromptVo = null;
         try {
-        communityUserPrompt = communityUserPromptMapper.selectOne(new QueryWrapper<CommunityUserPrompt>()
-                  .eq("create_by",userId));
-
-          System.out.println(communityUserPrompt);
+            communityUserPromptVo = communityArticleService.selectCommunityUserPrompt(userId);
         } catch (Exception e) {
-           e.printStackTrace();
+            System.out.println(e.getMessage());
+            throw new ProjectException();
         }
-        return AjaxResult.success(communityUserPrompt);
+        return AjaxResult.success(communityUserPromptVo);
     }
 
-
-
-
 }

+ 5 - 3
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityChatMsgController.java

@@ -8,7 +8,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.user.ProjectException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.generator.domain.Community.CommunityArticle;
 import com.ruoyi.generator.domain.Community.CommunityUserBlock;
 import com.ruoyi.generator.mapper.community.CommunityUserBlockMapper;
 import com.ruoyi.system.domain.CommunityChatMsg;
@@ -112,8 +111,8 @@ public class CommunityChatMsgController extends BaseController {
                 chatMsgVos.add(chatMsgVo);
             }
         } catch (Exception e) {
-            e.printStackTrace();
-            //throw new ProjectException();
+            System.out.println(e.getMessage());
+            throw new ProjectException();
         }
 
 
@@ -131,6 +130,7 @@ public class CommunityChatMsgController extends BaseController {
         try {
             sysUserChatVos = communityChatMsgService.getChatListWithLatestMessage(userId, type);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success(sysUserChatVos);
@@ -151,6 +151,7 @@ public class CommunityChatMsgController extends BaseController {
             hasUnreadMessages = sysUserChatVos.stream()
                     .anyMatch(vo -> Objects.equals(vo.getReceiverId(), userId) && !vo.isReceiverIsRead());
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success(hasUnreadMessages);
@@ -185,6 +186,7 @@ public class CommunityChatMsgController extends BaseController {
                             })
             );
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
         return AjaxResult.success("清空聊天记录成功");

+ 4 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityCommentController.java

@@ -126,6 +126,7 @@ public class CommunityCommentController extends BaseController {
                 vo.setReply(false);
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -176,6 +177,7 @@ public class CommunityCommentController extends BaseController {
                 replyVos.add(replyVo);
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -207,6 +209,7 @@ public class CommunityCommentController extends BaseController {
             communityCommentReply.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
             communityCommentReplyService.save(communityCommentReply);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -239,6 +242,7 @@ public class CommunityCommentController extends BaseController {
             communityCommentReply.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
             communityCommentReplyService.updateById(communityCommentReply);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 

+ 2 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityReportController.java

@@ -56,6 +56,7 @@ public class CommunityReportController extends BaseController {
                 }
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -76,6 +77,7 @@ public class CommunityReportController extends BaseController {
         try {
             communityReportService.save(communityReport);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 

+ 4 - 6
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunitySettingsController.java

@@ -3,10 +3,8 @@ package com.ruoyi.generator.controller;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.exception.user.ProjectException;
 import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.generator.domain.Community.CommunityArticle;
 import com.ruoyi.generator.domain.Community.CommunityUserNotification;
 import com.ruoyi.generator.domain.Community.CommunityUserPrivacy;
-import com.ruoyi.generator.service.ICommunityArticleService;
 import com.ruoyi.generator.service.ICommunityNotificationService;
 import com.ruoyi.generator.service.ICommunityPrivacyService;
 import com.ruoyi.generator.vo.CommunityUserNotificationVo;
@@ -50,6 +48,7 @@ public class CommunitySettingsController {
         try {
             communityUserNotificationVos = communityNotificationService.selectUserNotification(SecurityUtils.getLoginUser().getUserId());
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -68,6 +67,7 @@ public class CommunitySettingsController {
         try {
             communityUserNotificationVos = communityNotificationService.modifyUserNotification(communityUserNotification);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -91,6 +91,7 @@ public class CommunitySettingsController {
         try {
             communityUserPrivacyVos = communityPrivacyService.selectUserPrivacy(userId);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -109,13 +110,10 @@ public class CommunitySettingsController {
         try {
             communityUserPrivacyVos = communityPrivacyService.modifyUserPrivacy(communityUserPrivacy);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
         return AjaxResult.success(communityUserPrivacyVos);
     }
-
-
-
-
 }

+ 4 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityTagController.java

@@ -60,6 +60,7 @@ public class CommunityTagController extends BaseController {
                     .like("tag_name", tagName)
                     .orderByDesc("tag_hot")).getRecords();
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -108,6 +109,7 @@ public class CommunityTagController extends BaseController {
                 }
             }
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -144,6 +146,7 @@ public class CommunityTagController extends BaseController {
             System.out.println("communityTag: " + communityTag);
             communityTagService.save(communityTag);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 
@@ -166,6 +169,7 @@ public class CommunityTagController extends BaseController {
         try {
             communityTagBlock = communityTagService.blockTag(tagBlock);
         } catch (Exception e) {
+            System.out.println(e.getMessage());
             throw new ProjectException();
         }
 

+ 5 - 20
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/Community/CommunityUserPrompt.java

@@ -28,6 +28,11 @@ public class CommunityUserPrompt implements Serializable  {
     @TableId(type = IdType.AUTO, value = "id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
+    /**
+     * 用户id
+     */
+    @ApiModelProperty("用户id")
+    private Long userId;
 
     /**
      * 赞和收藏
@@ -47,26 +52,6 @@ public class CommunityUserPrompt implements Serializable  {
     @ApiModelProperty("评论与@")
     private Boolean commentCircle;
 
-    /**
-     * 创建者
-     */
-    private Long createBy;
-
-    /**
-     * 创建时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    /**
-     * 更新者
-     */
-    private Long updateBy;
 
-    /**
-     * 更新时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date updateTime;
 
 }

+ 3 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/Community/TrendingTop.java

@@ -17,6 +17,9 @@ public class TrendingTop {
 
     @ApiModelProperty("类型")
     private String type;
+
+    @ApiModelProperty("id")
+    private Long id;
     @ApiModelProperty("内容")
     private String content;
 

+ 47 - 6
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -109,6 +109,8 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
     @Autowired
     private CommunityUserBlockMapper communityUserBlockMapper;
 
+    @Autowired
+    private CommunityUserPromptMapper communityUserPromptMapper;
     /**
      * 查询文章列表
      *
@@ -661,7 +663,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
 
             if (Objects.nonNull(sysUser)) {
                 communityUserLikeVo.setAvatar(sysUser.getAvatar());
-                communityUserLikeVo.setUsername(sysUser.getUserName());
+                communityUserLikeVo.setUsername(sysUser.getNickName());
             }
 
             if (Objects.nonNull(userInfo)){
@@ -669,7 +671,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             }
 
             if (Objects.nonNull(sysUserLike)){
-                communityUserLikeVo.setLikeUsername(sysUserLike.getUserName());
+                communityUserLikeVo.setLikeUsername(sysUserLike.getNickName());
                 communityUserLikeVo.setLikeAvatar(sysUserLike.getAvatar());
             }
 
@@ -714,8 +716,8 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
                 SysUser sysUser = sysUserMapper.selectUserById(communityUserLike.getUserId());
                 communityUserLikeVo.setProfile(userInfo.getProfile());
                 communityUserLikeVo.setAvatar(sysUser.getAvatar());
-                communityUserLikeVo.setUsername(sysUser.getUserName());
-                communityUserLikeVo.setLikeUsername(sysUserLike.getUserName());
+                communityUserLikeVo.setUsername(sysUser.getNickName());
+                communityUserLikeVo.setLikeUsername(sysUserLike.getNickName());
                 communityUserLikeVo.setLikeAvatar(sysUserLike.getAvatar());
                 communityUserLikeVo.setLikeProfile(likeUserInfo.getProfile());
 
@@ -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;
+    }
 
     /**
      * 判断是否是视频文件

+ 6 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/ICommunityArticleService.java

@@ -175,4 +175,10 @@ public interface ICommunityArticleService extends IService<CommunityArticle> {
      */
     List<TrendingTop> selectTrendingTopByContent(@Param("content") String content);
 
+    /**
+     * 个人中心简介信息
+     * @param userId
+     * @return
+     */
+    List<CommunityUserPromptVo> selectCommunityUserPrompt(Long userId);
 }

+ 57 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/vo/CommunityUserPromptVo.java

@@ -0,0 +1,57 @@
+package com.ruoyi.generator.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 个人中心通知表 By Qing
+ * @TableName community_user_prompt
+ */
+@Data
+@TableName("community_user_prompt")
+public class CommunityUserPromptVo implements Serializable  {
+    /**
+     * 唯一id
+     */
+    @NotNull(message = "[唯一id]不能为空")
+    @ApiModelProperty("唯一id")
+    @TableId(type = IdType.AUTO, value = "id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+    /**
+     * 用户id
+     */
+    @ApiModelProperty("用户id")
+    private Long userId;
+
+    /**
+     * 赞和收藏
+     */
+    @ApiModelProperty("赞和收藏")
+    private Boolean  likeCollect;
+
+    /**
+     * 新增关注
+     */
+    @ApiModelProperty("新增关注")
+    private Boolean likeUser;
+
+    /**
+     * 评论与@
+     */
+    @ApiModelProperty("评论与@")
+    private Boolean commentCircle;
+
+
+
+}

+ 4 - 4
ruoyi-generator/src/main/resources/mapper/community/ArticleMapper.xml

@@ -311,20 +311,20 @@
 
     <select id="selectTrendingTopByContent" resultType="com.ruoyi.generator.domain.Community.TrendingTop">
         SELECT
-            type, content
+            distinct type,id,content
         FROM (
                  SELECT
-                     'article' as type, title as content
+                     'article' as type, id,title as content
                  FROM community_article
                  WHERE title LIKE CONCAT( #{content}, '%') AND is_delete != '1'
                  UNION ALL
                  SELECT
-                     'tag' as type, tag_name
+                     'tag' as type, id,tag_name
                  FROM community_tag
                  WHERE tag_name LIKE CONCAT( #{content}, '%') AND is_delete != '1'
                  UNION ALL
                  SELECT
-                     'user' as type, nick_name
+                     'user' as type, user_id,nick_name
                  FROM sys_user
                  WHERE nick_name LIKE CONCAT( #{content}, '%') AND status = '0'
              ) AS A