Przeglądaj źródła

95:红德堂APP调试

评论回复点赞修改
Long 2 dni temu
rodzic
commit
9d30a4f082

+ 14 - 6
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseCommentMapper.java

@@ -8,6 +8,7 @@ import com.fs.course.vo.FsUserCourseCommentListUVO;
 import com.fs.course.vo.FsUserCourseCommentListVO;
 import com.fs.course.vo.FsUserCourseCommentReplyListUVO;
 import com.fs.course.vo.FsUserCourseCommentVO;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
@@ -118,13 +119,20 @@ public interface FsUserCourseCommentMapper
     List<FsUserCourseCommentListUVO> selectFsUserCourseCommentListVOByCourseId(Long courseId);
 
     @Select({"<script> " +
-            "select c.*,u.nick_name,u.avatar,tu.nick_name to_nick_name  from fs_user_course_comment c " +
-            " LEFT JOIN fs_user u ON c.user_id=u.user_id " +
-            " LEFT  JOIN fs_user tu ON tu.user_id =c.to_user_id " +
-            " where c.is_del = 0 and c.type = 2 and c.parent_id = #{commentId} " +
-            " order by c.comment_id desc "+
+            "SELECT c.*, u.nick_name, u.avatar, tu.nick_name to_nick_name, " +
+            "<if test='userId != null and userId != \"\"'>" +
+            "   IFNULL(l.id, 0) AS is_like " +
+            "</if>" +
+            "FROM fs_user_course_comment c " +
+            "LEFT JOIN fs_user u ON c.user_id = u.user_id " +
+            "LEFT JOIN fs_user tu ON tu.user_id = c.to_user_id " +
+            "<if test='userId != null and userId != \"\"'>" +
+            "   LEFT JOIN fs_user_course_comment_like l ON c.comment_id = l.comment_id AND #{userId} = l.user_id " +
+            "</if>" +
+            "WHERE c.is_del = 0 AND c.type = 2 AND c.parent_id = #{commentId} " +
+            "ORDER BY c.comment_id DESC" +
             "</script>"})
-    List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(Long commentId);
+    List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(@Param("commentId") Long commentId, @Param("userId") String userId);
 
     @Select({"<script> " +
             "select c.*,u.nick_name,u.avatar,tu.nick_name to_nick_name from fs_user_course_comment c " +

+ 1 - 1
fs-service/src/main/java/com/fs/course/service/IFsUserCourseCommentService.java

@@ -73,7 +73,7 @@ public interface IFsUserCourseCommentService
 
     List<FsUserCourseCommentListUVO> selectFsUserCourseCommentListUVO(FsUserCourseCommentUParam param);
 
-    List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(Long commentId);
+    List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(Long commentId, String userId);
 
     List<FsUserCourseCommentListUVO> selectFsUserCourseCommentMyListUVO(Long userId);
 

+ 2 - 2
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseCommentServiceImpl.java

@@ -150,7 +150,7 @@ public class FsUserCourseCommentServiceImpl implements IFsUserCourseCommentServi
     }
 
     @Override
-    public List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(Long commentId) {
-        return fsUserCourseCommentMapper.selectFsUserCourseCommentReplyListUVO(commentId);
+    public List<FsUserCourseCommentReplyListUVO> selectFsUserCourseCommentReplyListUVO(Long commentId, String userId) {
+        return fsUserCourseCommentMapper.selectFsUserCourseCommentReplyListUVO(commentId, userId);
     }
 }

+ 2 - 1
fs-service/src/main/java/com/fs/course/vo/FsUserCourseCommentReplyListUVO.java

@@ -45,5 +45,6 @@ public class FsUserCourseCommentReplyListUVO {
     private Date createTime;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
-
+    //是否点赞 1是 0否
+    private Integer isLike;
 }

+ 1 - 1
fs-user-app/src/main/java/com/fs/app/controller/CourseCommentController.java

@@ -77,7 +77,7 @@ public class CourseCommentController extends AppBaseController
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
         List<FsUserCourseCommentListUVO> list = fsUserCourseCommentService.selectFsUserCourseCommentListUVO(param);
         list.forEach(comment -> {
-            List<FsUserCourseCommentReplyListUVO> replies = fsUserCourseCommentService.selectFsUserCourseCommentReplyListUVO(comment.getCommentId());
+            List<FsUserCourseCommentReplyListUVO> replies = fsUserCourseCommentService.selectFsUserCourseCommentReplyListUVO(comment.getCommentId(), getUserId());
             comment.setReplyList(replies);
         });
         PageInfo<FsUserCourseCommentListUVO> listPageInfo=new PageInfo<>(list);