Explorar o código

修改我的近况

Alex %!s(int64=4) %!d(string=hai) anos
pai
achega
f2bbb9c875
Modificáronse 19 ficheiros con 328 adicións e 39 borrados
  1. 2 1
      ruoyi-app/src/main/java/com/ruoyi/app/base/AppTokenService.java
  2. 2 2
      ruoyi-app/src/main/java/com/ruoyi/app/controller/AppLoginController.java
  3. 36 9
      ruoyi-app/src/main/java/com/ruoyi/app/controller/MyPublishController.java
  4. 55 0
      ruoyi-app/src/main/java/com/ruoyi/app/controller/PublishCommentController.java
  5. 74 0
      ruoyi-app/src/main/java/com/ruoyi/app/controller/PublishThumbsController.java
  6. 2 2
      ruoyi-app/src/main/java/com/ruoyi/app/controller/base/AppBaseController.java
  7. 7 0
      ruoyi-app/src/main/java/com/ruoyi/app/controller/base/AppCommonController.java
  8. 12 0
      ruoyi-system/src/main/java/com/ruoyi/app/domain/TbMyPublish.java
  9. 5 0
      ruoyi-system/src/main/java/com/ruoyi/app/domain/TbPublishThumbs.java
  10. 6 0
      ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbPublishCommentMapper.java
  11. 8 0
      ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbPublishThumbsMapper.java
  12. 6 0
      ruoyi-system/src/main/java/com/ruoyi/app/service/ITbPublishCommentService.java
  13. 7 0
      ruoyi-system/src/main/java/com/ruoyi/app/service/ITbPublishThumbsService.java
  14. 55 3
      ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbMyPublishServiceImpl.java
  15. 7 0
      ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbPublishCommentServiceImpl.java
  16. 13 0
      ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbPublishThumbsServiceImpl.java
  17. 22 21
      ruoyi-system/src/main/resources/mapper/app/TbMyPublishMapper.xml
  18. 5 0
      ruoyi-system/src/main/resources/mapper/app/TbPublishCommentMapper.xml
  19. 4 1
      ruoyi-system/src/main/resources/mapper/app/TbPublishThumbsMapper.xml

+ 2 - 1
ruoyi-app/src/main/java/com/ruoyi/app/base/AppTokenService.java

@@ -53,7 +53,8 @@ public class AppTokenService {
      *
      *
      * @return 用户信息
      * @return 用户信息
      */
      */
-    public AppLoginUser getLoginUser(HttpServletRequest request) {
+    public AppLoginUser getLoginUser() {
+        HttpServletRequest request = ServletUtils.getRequest();
         // 获取请求携带的令牌
         // 获取请求携带的令牌
         String token = getToken(request);
         String token = getToken(request);
         if (StringUtils.isNotEmpty(token)) {
         if (StringUtils.isNotEmpty(token)) {

+ 2 - 2
ruoyi-app/src/main/java/com/ruoyi/app/controller/AppLoginController.java

@@ -78,7 +78,7 @@ public class AppLoginController {
             appUser.setCreateBy(appUser.getId());
             appUser.setCreateBy(appUser.getId());
         }
         }
 
 
-        //手机短信验证 // TODO 调试通过,以后测试在放开注释
+        //手机短信验证
         boolean ckCaptcha = AliSMSUtil.getInstance().validateSmsCode(mobile, captcha);
         boolean ckCaptcha = AliSMSUtil.getInstance().validateSmsCode(mobile, captcha);
         if (!ckCaptcha) {
         if (!ckCaptcha) {
             return AjaxResult.error("验证码错误");
             return AjaxResult.error("验证码错误");
@@ -115,7 +115,7 @@ public class AppLoginController {
     @PassToken
     @PassToken
     @ApiOperation(value = "发送短信验证码", notes = "发送短信验证码")
     @ApiOperation(value = "发送短信验证码", notes = "发送短信验证码")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "type", value = "1.用户注册;2.登录确认;3.身份验证;4.登录异常;5.修改密码;6.信息变更",paramType="string"),
+            @ApiImplicitParam(name = "type", value = "1.用户注册;2.登录确认;3.身份验证;4.登录异常;5.修改密码;6.信息变更",paramType="int"),
             @ApiImplicitParam(name = "mobile", value = "手机号",paramType="string")
             @ApiImplicitParam(name = "mobile", value = "手机号",paramType="string")
     })
     })
     @GetMapping("/captchaSend")
     @GetMapping("/captchaSend")

+ 36 - 9
ruoyi-app/src/main/java/com/ruoyi/app/controller/AppUserController.java → ruoyi-app/src/main/java/com/ruoyi/app/controller/MyPublishController.java

@@ -3,6 +3,7 @@ package com.ruoyi.app.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.app.controller.base.AppBaseController;
 import com.ruoyi.app.controller.base.AppBaseController;
+import com.ruoyi.app.domain.TbAppUser;
 import com.ruoyi.app.domain.TbMyPublish;
 import com.ruoyi.app.domain.TbMyPublish;
 import com.ruoyi.app.service.ITbAppUserService;
 import com.ruoyi.app.service.ITbAppUserService;
 import com.ruoyi.app.service.ITbMyPublishService;
 import com.ruoyi.app.service.ITbMyPublishService;
@@ -13,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
@@ -20,36 +22,61 @@ import org.springframework.web.bind.annotation.RestController;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * 会员管理
+ * 我的近况
  *
  *
  * @author Alex
  * @author Alex
  * @date 2020-10-09
  * @date 2020-10-09
  */
  */
-@Api(value = "会员管理",tags = "会员管理")
+@Api(value = "我的近况",tags = "我的近况")
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
 @RestController
-@RequestMapping("/app/user" )
-public class AppUserController extends AppBaseController {
+@RequestMapping("/app/publish" )
+public class MyPublishController extends AppBaseController {
 
 
     private final ITbMyPublishService publishService;
     private final ITbMyPublishService publishService;
-
     private final ITbAppUserService userService;
     private final ITbAppUserService userService;
 
 
     /**
     /**
      * 查询家族朋友圈
      * 查询家族朋友圈
      * @return
      * @return
      */
      */
-    @ApiOperation(value = "查询家族朋友圈", notes = "查询家族朋友圈")
+    @ApiOperation("族友圈 分页列表")
     @ApiImplicitParam(name = "userId", value = "会员ID",paramType="Long")
     @ApiImplicitParam(name = "userId", value = "会员ID",paramType="Long")
     @GetMapping("/selectCircle")
     @GetMapping("/selectCircle")
     public TableDataInfo selectCircle(Long userId){
     public TableDataInfo selectCircle(Long userId){
-        LambdaQueryWrapper<TbMyPublish> lqw = new LambdaQueryWrapper();
         if (userId == null) {
         if (userId == null) {
             return new TableDataInfo();
             return new TableDataInfo();
         }
         }
-        lqw.eq(TbMyPublish::getAppUserId,userId);
-        List<TbMyPublish> list = publishService.selectPublish(lqw);
+        List<TbMyPublish> list = publishService.selectPublish(new LambdaQueryWrapper<TbMyPublish>()
+                .eq(TbMyPublish::getAppUserId,userId)
+        );
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
+    /**
+     * 查询我的近况 列表
+     */
+    @ApiOperation("我的近况 分页列表")
+    @ApiImplicitParam(name = "userId", value = "会员ID",paramType="Long")
+    @GetMapping("/myList")
+    public TableDataInfo pageList(Long userId) {
+        if (userId == null) {
+            return new TableDataInfo();
+        }
+        TbMyPublish tbMyPublish = new TbMyPublish();
+        tbMyPublish.setAppUserId(userId);
+        tbMyPublish.setDeleted("N");
+        return publishService.pageList(tbMyPublish);
+    }
+
+
+    @ApiOperation("登录信息")
+    @GetMapping("/loginUser")
+    public AjaxResult loginUser(){
+
+        TbAppUser user = getLoginUser().getUser();
+        return AjaxResult.success(user);
+    }
+
+
 }
 }

+ 55 - 0
ruoyi-app/src/main/java/com/ruoyi/app/controller/PublishCommentController.java

@@ -0,0 +1,55 @@
+package com.ruoyi.app.controller;
+
+import com.ruoyi.app.controller.base.AppBaseController;
+import com.ruoyi.app.domain.TbAppUser;
+import com.ruoyi.app.domain.TbPublishComment;
+import com.ruoyi.app.service.ITbPublishCommentService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * 评论
+ *
+ * @author Alex
+ * @date 2020-10-09
+ */
+@Api(value = "评论管理",tags = "评论管理")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/comment" )
+public class PublishCommentController extends AppBaseController {
+
+    private final ITbPublishCommentService commentService;
+
+    /**
+     * 添加评论
+     * @param comment
+     * @return
+     */
+    @ApiOperation("添加评论")
+    @GetMapping("/add")
+    public AjaxResult addComment(TbPublishComment comment) {
+        if (comment.getPublishId() == null || comment.getAppUserId() == null) {
+            return AjaxResult.error("参数为空");
+        }
+        if (StringUtils.isBlank(comment.getContents())){
+            return AjaxResult.error("评论内容不能为空");
+        }
+        TbAppUser user = getLoginUser().getUser();
+        comment.setCreateBy(user.getId().toString());
+        comment.setCreateTime(new Date());
+        if (commentService.save(comment)){
+            return AjaxResult.success("评论成功");
+        }
+        return AjaxResult.error("评论失败");
+    }
+}

+ 74 - 0
ruoyi-app/src/main/java/com/ruoyi/app/controller/PublishThumbsController.java

@@ -0,0 +1,74 @@
+package com.ruoyi.app.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.app.base.AppLoginUser;
+import com.ruoyi.app.controller.base.AppBaseController;
+import com.ruoyi.app.domain.TbAppUser;
+import com.ruoyi.app.domain.TbPublishThumbs;
+import com.ruoyi.app.service.ITbPublishThumbsService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * 点赞记录
+ *
+ * @author Alex
+ * @date 2020-10-09
+ */
+@Api(value = "点赞记录",tags = "点赞记录")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/thumbs" )
+public class PublishThumbsController extends AppBaseController {
+
+    private final ITbPublishThumbsService thumbsService;
+
+    /**
+     * 点赞/取消
+     * @param userId
+     * @param publishId
+     * @return
+     */
+    @ApiOperation("点赞/取消")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId", value = "点赞人id",paramType="Long"),
+            @ApiImplicitParam(name = "publishId", value = "发表id",paramType="Long")
+    })
+    @GetMapping("/action")
+    public AjaxResult action(Long userId,Long publishId){
+        // TODO 在点赞或取消时,APP端的点赞数组异步增加或去掉记录
+        if (userId == null || publishId == null) {
+            return AjaxResult.error("参数不能为空");
+        }
+        TbPublishThumbs thumbs = thumbsService.getOne(new LambdaQueryWrapper<TbPublishThumbs>()
+                .eq(TbPublishThumbs::getPublishId, publishId)
+                .eq(TbPublishThumbs::getAppUserId,userId)
+        );
+        TbAppUser user = getLoginUser().getUser();
+        Date date = new Date();
+        // 点赞
+        if (thumbs == null) {
+            thumbs = new TbPublishThumbs();
+            thumbs.setAppUserId(userId);
+            thumbs.setPublishId(publishId);
+            thumbs.setCreateBy(user.getId().toString());
+            thumbs.setCreateTime(date);
+            thumbsService.save(thumbs);
+        } else { // 取消
+            thumbsService.removeById(thumbs.getId());
+        }
+        return AjaxResult.success();
+    }
+}

+ 2 - 2
ruoyi-app/src/main/java/com/ruoyi/app/controller/base/AppBaseController.java

@@ -92,7 +92,7 @@ public class AppBaseController {
      * 根据token获取登录用户
      * 根据token获取登录用户
      * @return
      * @return
      */
      */
-    protected AppLoginUser getLoginUser(HttpServletRequest request){
-        return appTokenService.getLoginUser(request);
+    protected AppLoginUser getLoginUser(){
+        return appTokenService.getLoginUser();
     }
     }
 }
 }

+ 7 - 0
ruoyi-app/src/main/java/com/ruoyi/app/controller/base/AppCommonController.java

@@ -7,6 +7,8 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.framework.config.ServerConfig;
 import com.ruoyi.framework.config.ServerConfig;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
 /**
 /**
  * 通用请求处理
  * 通用请求处理
  */
  */
+@Api(value = "通用请求处理",tags = "通用请求处理")
 @RestController
 @RestController
 @RequestMapping("/app" )
 @RequestMapping("/app" )
 public class AppCommonController {
 public class AppCommonController {
@@ -37,6 +40,7 @@ public class AppCommonController {
      * @param fileName 文件名称
      * @param fileName 文件名称
      * @param delete 是否删除
      * @param delete 是否删除
      */
      */
+    @ApiOperation(value = "通用下载请求", notes = "通用下载请求")
     @GetMapping("/common/download")
     @GetMapping("/common/download")
     public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
     public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
     {
     {
@@ -68,6 +72,7 @@ public class AppCommonController {
     /**
     /**
      * 通用上传请求
      * 通用上传请求
      */
      */
+    @ApiOperation(value = "通用上传请求", notes = "通用上传请求")
     @PostMapping("/common/upload")
     @PostMapping("/common/upload")
     public AjaxResult uploadFile(MultipartFile file) throws Exception {
     public AjaxResult uploadFile(MultipartFile file) throws Exception {
         try
         try
@@ -88,6 +93,7 @@ public class AppCommonController {
     /**
     /**
      * 图片上传请求
      * 图片上传请求
      */
      */
+    @ApiOperation(value = "图片上传请求", notes = "图片上传请求")
     @PostMapping("/common/uploadImg")
     @PostMapping("/common/uploadImg")
     public AjaxResult uploadFile(MultipartHttpServletRequest multiReq) throws Exception {
     public AjaxResult uploadFile(MultipartHttpServletRequest multiReq) throws Exception {
         try {
         try {
@@ -108,6 +114,7 @@ public class AppCommonController {
     /**
     /**
      * 本地资源通用下载
      * 本地资源通用下载
      */
      */
+    @ApiOperation(value = "本地资源通用下载", notes = "本地资源通用下载")
     @GetMapping("/common/download/resource")
     @GetMapping("/common/download/resource")
     public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
     public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
         // 本地资源路径
         // 本地资源路径

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/app/domain/TbMyPublish.java

@@ -70,6 +70,14 @@ public class TbMyPublish extends BaseEntity {
     @ApiModelProperty(value="图片列表")
     @ApiModelProperty(value="图片列表")
     @TableField(exist = false)
     @TableField(exist = false)
     private List<TbPublishImg> imgList;
     private List<TbPublishImg> imgList;
+
+    @ApiModelProperty(value="评论列表")
+    @TableField(exist = false)
+    private List<TbPublishComment> commentList;
+
+    @ApiModelProperty(value="点赞列表")
+    @TableField(exist = false)
+    private List<TbPublishThumbs> thumbsList;
     /**
     /**
      * 评论数
      * 评论数
      */
      */
@@ -88,4 +96,8 @@ public class TbMyPublish extends BaseEntity {
     @ApiModelProperty(value="纪念留言人")
     @ApiModelProperty(value="纪念留言人")
     @TableField(exist = false)
     @TableField(exist = false)
     private String messageUser;
     private String messageUser;
+
+    @ApiModelProperty(value="留念前缀")
+    @TableField(exist = false)
+    private String messageContent;
 }
 }

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/app/domain/TbPublishThumbs.java

@@ -1,5 +1,6 @@
 package com.ruoyi.app.domain;
 package com.ruoyi.app.domain;
 
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -72,4 +73,8 @@ public class TbPublishThumbs implements Serializable {
     @ApiModelProperty(value="备注")
     @ApiModelProperty(value="备注")
     @Excel(name = "备注")
     @Excel(name = "备注")
     private String remark;
     private String remark;
+
+    @ApiModelProperty(value="点赞人")
+    @TableField(exist = false)
+    private String appUserName;
 }
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbPublishCommentMapper.java

@@ -1,7 +1,12 @@
 package com.ruoyi.app.mapper;
 package com.ruoyi.app.mapper;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.ruoyi.app.domain.TbPublishComment;
 import com.ruoyi.app.domain.TbPublishComment;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 /**
 /**
  * 我的近况评论
  * 我的近况评论
@@ -11,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface TbPublishCommentMapper extends BaseMapper<TbPublishComment> {
 public interface TbPublishCommentMapper extends BaseMapper<TbPublishComment> {
 
 
+    List<TbPublishComment> selectList(@Param(Constants.WRAPPER) LambdaQueryWrapper<TbPublishComment> wrapper);
 }
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbPublishThumbsMapper.java

@@ -1,7 +1,13 @@
 package com.ruoyi.app.mapper;
 package com.ruoyi.app.mapper;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.ruoyi.app.domain.TbMyPublish;
 import com.ruoyi.app.domain.TbPublishThumbs;
 import com.ruoyi.app.domain.TbPublishThumbs;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 /**
 /**
  * 我的近况点赞记录
  * 我的近况点赞记录
@@ -11,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface TbPublishThumbsMapper extends BaseMapper<TbPublishThumbs> {
 public interface TbPublishThumbsMapper extends BaseMapper<TbPublishThumbs> {
 
 
+    List<TbPublishThumbs> selectList(@Param(Constants.WRAPPER) LambdaQueryWrapper<TbMyPublish> wrapper);
+
 }
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/ITbPublishCommentService.java

@@ -1,7 +1,12 @@
 package com.ruoyi.app.service;
 package com.ruoyi.app.service;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.ruoyi.app.domain.TbPublishComment;
 import com.ruoyi.app.domain.TbPublishComment;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 /**
 /**
  * 我的近况评论
  * 我的近况评论
@@ -11,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface ITbPublishCommentService extends IService<TbPublishComment> {
 public interface ITbPublishCommentService extends IService<TbPublishComment> {
 
 
+    List<TbPublishComment> selectList(LambdaQueryWrapper<TbPublishComment> wrapper);
 }
 }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/ITbPublishThumbsService.java

@@ -1,7 +1,13 @@
 package com.ruoyi.app.service;
 package com.ruoyi.app.service;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.ruoyi.app.domain.TbMyPublish;
 import com.ruoyi.app.domain.TbPublishThumbs;
 import com.ruoyi.app.domain.TbPublishThumbs;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 /**
 /**
  * 我的近况点赞记录
  * 我的近况点赞记录
@@ -11,4 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface ITbPublishThumbsService extends IService<TbPublishThumbs> {
 public interface ITbPublishThumbsService extends IService<TbPublishThumbs> {
 
 
+    List<TbPublishThumbs> selectList(LambdaQueryWrapper<TbPublishThumbs> wrapper);
 }
 }

+ 55 - 3
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbMyPublishServiceImpl.java

@@ -62,6 +62,11 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
         return rspData;
         return rspData;
     }
     }
 
 
+    /**
+     * 我的近况列表
+     * @param tbMyPublish
+     * @return
+     */
     @Override
     @Override
     public TableDataInfo pageList(TbMyPublish tbMyPublish) {
     public TableDataInfo pageList(TbMyPublish tbMyPublish) {
         LambdaQueryWrapper<TbMyPublish> lqw = new LambdaQueryWrapper<TbMyPublish>();
         LambdaQueryWrapper<TbMyPublish> lqw = new LambdaQueryWrapper<TbMyPublish>();
@@ -82,6 +87,11 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
+    /**
+     * 我的近况详情
+     * @param id
+     * @return
+     */
     @Override
     @Override
     public TbMyPublish getPublish(Long id) {
     public TbMyPublish getPublish(Long id) {
         TbMyPublish publish = this.getById(id);
         TbMyPublish publish = this.getById(id);
@@ -119,7 +129,6 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
      * @param publishId 近况id
      * @param publishId 近况id
      * @return
      * @return
      */
      */
-    @Async
     @Override
     @Override
     public int getThumbs(Long publishId) {
     public int getThumbs(Long publishId) {
         int count = thumbsService.count(new LambdaQueryWrapper<TbPublishThumbs>()
         int count = thumbsService.count(new LambdaQueryWrapper<TbPublishThumbs>()
@@ -132,7 +141,6 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
      * @param publishId 近况id
      * @param publishId 近况id
      * @return
      * @return
      */
      */
-    @Async
     @Override
     @Override
     public int getComments(Long publishId) {
     public int getComments(Long publishId) {
         int count = commentService.count(new LambdaQueryWrapper<TbPublishComment>()
         int count = commentService.count(new LambdaQueryWrapper<TbPublishComment>()
@@ -191,6 +199,50 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
      */
      */
     @Override
     @Override
     public List<TbMyPublish> selectPublish(LambdaQueryWrapper<TbMyPublish> wrapper) {
     public List<TbMyPublish> selectPublish(LambdaQueryWrapper<TbMyPublish> wrapper) {
-        return baseMapper.selectPublish(wrapper);
+        List<TbMyPublish> list = baseMapper.selectPublish(wrapper);
+        if (list.size() <= 0) {
+            return new ArrayList<>();
+        }
+        List<Long> ids = new ArrayList<>();
+        list.forEach(item -> {
+            ids.add(item.getId());
+        });
+        // 族友圈中放入图片列表 点赞列表 评论列表
+        List<TbPublishImg> imgList = imgService.list(new LambdaQueryWrapper<TbPublishImg>()
+            .in(TbPublishImg::getPublishId, ids)
+        );
+        List<TbPublishThumbs> thumbsList = thumbsService.selectList(new LambdaQueryWrapper<TbPublishThumbs>()
+                .in(TbPublishThumbs::getPublishId, ids)
+        );
+        List<TbPublishComment> commentList = commentService.selectList(new LambdaQueryWrapper<TbPublishComment>()
+                .in(TbPublishComment::getPublishId, ids)
+        );
+        list.forEach(item -> {
+            // 加入图片列表
+            List<TbPublishImg> imgs = new ArrayList<>();
+            imgList.forEach(img -> {
+                if (img.getPublishId().equals(item.getId())) {
+                    imgs.add(img);
+                }
+            });
+            item.setImgList(imgs);
+            // 加入点赞列表
+            List<TbPublishThumbs> thumbs = new ArrayList<>();
+            thumbsList.forEach(thumb -> {
+                if (thumb.getPublishId().equals(item.getId())){
+                    thumbs.add(thumb);
+                }
+            });
+            item.setThumbsList(thumbs);
+            // 加入评论列表
+            List<TbPublishComment> comments = new ArrayList<>();
+            commentList.forEach(comment -> {
+                if (comment.getPublishId().equals(item.getId())){
+                    comments.add(comment);
+                }
+            });
+            item.setCommentList(comments);
+        });
+        return list;
     }
     }
 }
 }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbPublishCommentServiceImpl.java

@@ -1,11 +1,14 @@
 package com.ruoyi.app.service.impl;
 package com.ruoyi.app.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.app.mapper.TbPublishCommentMapper;
 import com.ruoyi.app.mapper.TbPublishCommentMapper;
 import com.ruoyi.app.domain.TbPublishComment;
 import com.ruoyi.app.domain.TbPublishComment;
 import com.ruoyi.app.service.ITbPublishCommentService;
 import com.ruoyi.app.service.ITbPublishCommentService;
 
 
+import java.util.List;
+
 /**
 /**
  * 我的近况评论
  * 我的近况评论
  *
  *
@@ -15,4 +18,8 @@ import com.ruoyi.app.service.ITbPublishCommentService;
 @Service
 @Service
 public class TbPublishCommentServiceImpl extends ServiceImpl<TbPublishCommentMapper, TbPublishComment> implements ITbPublishCommentService {
 public class TbPublishCommentServiceImpl extends ServiceImpl<TbPublishCommentMapper, TbPublishComment> implements ITbPublishCommentService {
 
 
+    @Override
+    public List<TbPublishComment> selectList(LambdaQueryWrapper<TbPublishComment> wrapper){
+        return baseMapper.selectList(wrapper);
+    }
 }
 }

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbPublishThumbsServiceImpl.java

@@ -1,11 +1,15 @@
 package com.ruoyi.app.service.impl;
 package com.ruoyi.app.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.app.domain.TbMyPublish;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.app.mapper.TbPublishThumbsMapper;
 import com.ruoyi.app.mapper.TbPublishThumbsMapper;
 import com.ruoyi.app.domain.TbPublishThumbs;
 import com.ruoyi.app.domain.TbPublishThumbs;
 import com.ruoyi.app.service.ITbPublishThumbsService;
 import com.ruoyi.app.service.ITbPublishThumbsService;
 
 
+import java.util.List;
+
 /**
 /**
  * 我的近况点赞记录
  * 我的近况点赞记录
  *
  *
@@ -15,4 +19,13 @@ import com.ruoyi.app.service.ITbPublishThumbsService;
 @Service
 @Service
 public class TbPublishThumbsServiceImpl extends ServiceImpl<TbPublishThumbsMapper, TbPublishThumbs> implements ITbPublishThumbsService {
 public class TbPublishThumbsServiceImpl extends ServiceImpl<TbPublishThumbsMapper, TbPublishThumbs> implements ITbPublishThumbsService {
 
 
+    /**
+     * 查询点赞列表
+     * @param wrapper
+     * @return
+     */
+    @Override
+    public List<TbPublishThumbs> selectList(LambdaQueryWrapper<TbPublishThumbs> wrapper) {
+        return baseMapper.selectList(wrapper);
+    }
 }
 }

+ 22 - 21
ruoyi-system/src/main/resources/mapper/app/TbMyPublishMapper.xml

@@ -26,27 +26,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     </select>
 <!--    族友圈列表-->
 <!--    族友圈列表-->
     <select id="selectPublish" resultType="com.ruoyi.app.domain.TbMyPublish">
     <select id="selectPublish" resultType="com.ruoyi.app.domain.TbMyPublish">
-        select * from (
-        select a.*,
-        (select nick_name from tb_app_user us where us.id = a.app_user_id)nick_name,
-        (select nick_name from tb_app_user us where us.id = a.message_user_id)message_user,
-        (select count(1)  from tb_publish_thumbs where publish_id = 1)thumbs
-        from (
-            select * from tb_my_publish p
-            where deleted = 'N' and app_user_id in (
-                select f.app_user_id uid from tb_my_friends f where friends_user_id = 2 and status = 2
-                union all
-                select g.friends_user_id uid from tb_my_friends g  where app_user_id = 2 and status = 2
-            )
-            union
-            select * from tb_my_publish p
-            where deleted = 'N' and app_user_id in (
-                select u.id from tb_app_user u
-                left join tb_family_member m on u.id = m.app_user_id
-                left join tb_member_middle mi on m.id = mi.member_id
-                where family_id = 1 and deleted = 'N'
-            )
-        ) a
+        select b.*,(case when message = 'Y' then concat('#给',message_user,'的留言纪念') else '' end) message_content
+         from (
+            select a.*,
+            (select nick_name from tb_app_user us where us.id = a.app_user_id)nick_name,
+            (select nick_name from tb_app_user us where us.id = a.message_user_id)message_user,
+            (select count(1)  from tb_publish_thumbs where publish_id = 1)thumbs
+            from (
+                select * from tb_my_publish p
+                where deleted = 'N' and app_user_id in (
+                    select f.app_user_id uid from tb_my_friends f where friends_user_id = 2 and status = 2
+                    union all
+                    select g.friends_user_id uid from tb_my_friends g  where app_user_id = 2 and status = 2
+                )
+                union
+                select * from tb_my_publish p
+                where deleted = 'N' and app_user_id in (
+                    select u.id from tb_app_user u
+                    left join tb_family_member m on u.id = m.app_user_id
+                    left join tb_member_middle mi on m.id = mi.member_id
+                    where family_id = 1 and deleted = 'N'
+                )
+            ) a
         ) b
         ) b
         ${ew.customSqlSegment}
         ${ew.customSqlSegment}
     </select>
     </select>

+ 5 - 0
ruoyi-system/src/main/resources/mapper/app/TbPublishCommentMapper.xml

@@ -16,5 +16,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="remark"    column="remark"    />
         <result property="remark"    column="remark"    />
     </resultMap>
     </resultMap>
 
 
+    <select id="selectList" resultType="com.ruoyi.app.domain.TbPublishComment">
+        select c.*,(select nick_name from tb_app_user u where u.id = c.appUserId) appUser,
+        (select avatar from tb_app_user u where u.id = c.appUserId) appUserUrl
+        from tb_publish_comment ${ew.customSqlSegment}
+    </select>
 
 
 </mapper>
 </mapper>

+ 4 - 1
ruoyi-system/src/main/resources/mapper/app/TbPublishThumbsMapper.xml

@@ -15,5 +15,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="remark"    column="remark"    />
         <result property="remark"    column="remark"    />
     </resultMap>
     </resultMap>
 
 
-
+    <select id="selectList" resultType="com.ruoyi.app.domain.TbPublishThumbs">
+        select t.*,(select nick_name from tb_app_user u where u.id = t.create_by)
+        from tb_publisg_thumbs ${ew.customSqlSegment}
+    </select>
 </mapper>
 </mapper>