Browse Source

feat:管理端单独的评论模块

caoliqin 3 days ago
parent
commit
1dc575664d

+ 23 - 5
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchCommentController.java

@@ -3,7 +3,9 @@ package com.fs.course.controller;
 import java.util.List;
 
 import com.fs.common.core.domain.R;
+import com.fs.course.param.FsCourseWatchCommentPageParam;
 import com.fs.course.vo.FsCourseWatchCommentListVO;
+import com.fs.qw.service.IQwExternalContactService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -38,16 +40,19 @@ public class FsCourseWatchCommentController extends BaseController
     @Autowired
     private IFsCourseWatchCommentService fsCourseWatchCommentService;
 
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
     /**
      * 查询看课评论列表
      */
     @PreAuthorize("@ss.hasPermi('course:courseWatchComment:list')")
     @GetMapping("/list")
-    public R list(FsCourseWatchComment fsCourseWatchComment)
+    public R list(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam)
     {
 //        startPage();
-        PageHelper.startPage(fsCourseWatchComment.getPageNum(), fsCourseWatchComment.getPageSize());
-        List<FsCourseWatchCommentListVO> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchComment);
+        PageHelper.startPage(fsCourseWatchCommentPageParam.getPageNum(), fsCourseWatchCommentPageParam.getPageSize());
+        List<FsCourseWatchCommentListVO> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchCommentPageParam);
         PageInfo<FsCourseWatchCommentListVO> pageInfo = new PageInfo<>(list);
         return R.ok().put("rows", pageInfo);
     }
@@ -58,9 +63,9 @@ public class FsCourseWatchCommentController extends BaseController
     @PreAuthorize("@ss.hasPermi('course:courseWatchComment:export')")
     @Log(title = "看课评论", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(FsCourseWatchComment fsCourseWatchComment)
+    public AjaxResult export(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam)
     {
-        List<FsCourseWatchCommentListVO> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchComment);
+        List<FsCourseWatchCommentListVO> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchCommentPageParam);
         ExcelUtil<FsCourseWatchCommentListVO> util = new ExcelUtil<FsCourseWatchCommentListVO>(FsCourseWatchCommentListVO.class);
         return util.exportExcel(list, "看课评论数据");
     }
@@ -107,4 +112,17 @@ public class FsCourseWatchCommentController extends BaseController
     {
         return toAjax(fsCourseWatchCommentService.deleteFsCourseWatchCommentByCommentIds(commentIds));
     }
+
+    @Log(title = "手动拉黑外部联系人用户", businessType = BusinessType.UPDATE)
+    @PutMapping("/addBlack")
+    public R addBlack(Integer commentStatus, Long fsUserId)
+    {
+        int i = qwExternalContactService.updateQwExternalContactByFsUserId(commentStatus, fsUserId);
+        if (i > 0){
+            return R.ok();
+        } else {
+            return R.error();
+        }
+    }
+
 }

+ 0 - 12
fs-service/src/main/java/com/fs/course/domain/FsCourseWatchComment.java

@@ -17,18 +17,6 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 public class FsCourseWatchComment extends BaseEntity{
 
-    @TableField(exist = false)
-    @ApiModelProperty(value = "页码,默认为1", required = true)
-    private Integer pageNum = 1;
-
-    @TableField(exist = false)
-    @ApiModelProperty(value = "页大小,默认为10", required = true)
-    private Integer pageSize = 10;
-
-    @TableField(exist = false)
-    @ApiModelProperty(value = "用户名称")
-    private String nickName;
-
     /** 评论id */
     private Long commentId;
 

+ 3 - 2
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchCommentMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.course.domain.FsCourseWatchComment;
 import com.fs.course.param.FsCourseWatchCommentListParam;
+import com.fs.course.param.FsCourseWatchCommentPageParam;
 import com.fs.course.vo.FsCourseWatchCommentListVO;
 import com.fs.course.vo.FsCourseWatchCommentVO;
 import org.apache.ibatis.annotations.Update;
@@ -26,10 +27,10 @@ public interface FsCourseWatchCommentMapper extends BaseMapper<FsCourseWatchComm
     /**
      * 查询看课评论列表
      *
-     * @param fsCourseWatchComment 看课评论
+     * @param fsCourseWatchCommentPageParam 看课评论
      * @return 看课评论集合
      */
-    List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment);
+    List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam);
 
     /**
      * 新增看课评论

+ 33 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseWatchCommentPageParam.java

@@ -0,0 +1,33 @@
+package com.fs.course.param;
+
+import com.fs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 看课评论对象 fs_course_watch_comment
+ *
+ * @author fs
+ * @date 2025-05-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsCourseWatchCommentPageParam extends BaseEntity{
+
+    @ApiModelProperty(value = "页码,默认为1", required = true)
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10", required = true)
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "用户名称")
+    private String nickName;
+
+    @ApiModelProperty(value = "模糊搜索")
+    private String keywords;
+
+    @ApiModelProperty(value = "是否全部")
+    private Boolean isAll = false;
+
+}

+ 3 - 2
fs-service/src/main/java/com/fs/course/service/IFsCourseWatchCommentService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.common.core.domain.R;
 import com.fs.course.domain.FsCourseWatchComment;
 import com.fs.course.param.FsCourseWatchCommentListParam;
+import com.fs.course.param.FsCourseWatchCommentPageParam;
 import com.fs.course.param.FsCourseWatchCommentSaveParam;
 import com.fs.course.vo.FsCourseWatchCommentListVO;
 import com.fs.course.vo.FsCourseWatchCommentVO;
@@ -27,10 +28,10 @@ public interface IFsCourseWatchCommentService extends IService<FsCourseWatchComm
     /**
      * 查询看课评论列表
      *
-     * @param fsCourseWatchComment 看课评论
+     * @param fsCourseWatchCommentPageParam 看课评论
      * @return 看课评论集合
      */
-    List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment);
+    List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam);
 
     /**
      * 新增看课评论

+ 4 - 3
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchCommentServiceImpl.java

@@ -9,6 +9,7 @@ import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.course.param.FsCourseWatchCommentListParam;
+import com.fs.course.param.FsCourseWatchCommentPageParam;
 import com.fs.course.param.FsCourseWatchCommentSaveParam;
 import com.fs.course.vo.FsCourseWatchCommentListVO;
 import com.fs.course.vo.FsCourseWatchCommentVO;
@@ -61,13 +62,13 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
     /**
      * 查询看课评论列表
      *
-     * @param fsCourseWatchComment 看课评论
+     * @param fsCourseWatchCommentPageParam 看课评论
      * @return 看课评论
      */
     @Override
-    public List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment)
+    public List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam)
     {
-        return baseMapper.selectFsCourseWatchCommentList(fsCourseWatchComment);
+        return baseMapper.selectFsCourseWatchCommentList(fsCourseWatchCommentPageParam);
     }
 
     /**

+ 6 - 0
fs-service/src/main/java/com/fs/course/vo/FsCourseWatchCommentListVO.java

@@ -49,4 +49,10 @@ public class FsCourseWatchCommentListVO {
     @ApiModelProperty(value = "字体颜色")
     private String color;
 
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "小节名称")
+    private String title;
+
 }

+ 8 - 0
fs-service/src/main/java/com/fs/qw/service/IQwExternalContactService.java

@@ -184,4 +184,12 @@ public interface IQwExternalContactService extends IService<QwExternalContact> {
 
 
     List<QwExternalListByHeavyVO> getQwExternalListByHeavy(FsCourseListBySidebarParam param);
+
+    /**
+     * 根据userid修改外部联系人评论状态
+     * @param commentStatus 评论状态
+     * @param fsUserId 用户id
+     * @return
+     */
+    int updateQwExternalContactByFsUserId(Integer commentStatus, Long fsUserId);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -342,6 +342,11 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
         return qwUserMapper.getQwExternalListByHeavy(param);
     }
 
+    @Override
+    public int updateQwExternalContactByFsUserId(Integer commentStatus, Long fsUserId) {
+        return qwExternalContactMapper.updateQwExternalContactByFsUserId(commentStatus, fsUserId);
+    }
+
     /**
      * 处理一个分组(组内串行)
      */

+ 4 - 2
fs-service/src/main/resources/db/20250530-初始化表结构.sql

@@ -18,7 +18,7 @@ CREATE TABLE `sys_keyword`  (
 SET FOREIGN_KEY_CHECKS = 1;
 
 
-    
+
 
 SET NAMES utf8mb4;
 SET FOREIGN_KEY_CHECKS = 0;
@@ -44,7 +44,9 @@ CREATE TABLE `fs_course_watch_comment`  (
                                             `mode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '展示模式',
                                             `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '字体颜色',
                                             PRIMARY KEY (`comment_id`) USING BTREE,
-                                            INDEX `user_id_index`(`user_id` ASC) USING BTREE
+                                            INDEX `user_id_index`(`user_id` ASC) USING BTREE,
+                                            INDEX `course_id_index`(`course_id` ASC) USING BTREE,
+                                            INDEX `video_id_index`(`video_id` ASC) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 128 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '看课评论表' ROW_FORMAT = Dynamic;
 
 SET FOREIGN_KEY_CHECKS = 1;

+ 13 - 8
fs-service/src/main/resources/mapper/course/FsCourseWatchCommentMapper.xml

@@ -45,19 +45,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         fs_course_watch_comment.`mode`,
         fs_course_watch_comment.color,
         fs_user.nick_name
+        <if test="isAll != null and isAll == true ">
+            ,fs_user_course.course_name, fs_user_course_video.title
+        </if>
         FROM
         fs_course_watch_comment
         LEFT JOIN fs_user ON fs_user.user_id = fs_course_watch_comment.user_id
+        <if test="isAll != null and isAll == true">
+            LEFT JOIN fs_user_course on fs_user_course.course_id = fs_course_watch_comment.course_id
+            LEFT JOIN fs_user_course_video on fs_user_course_video.video_id = fs_course_watch_comment.video_id
+        </if>
         <where>
-            <if test="userId != null "> and fs_course_watch_comment.user_id = #{userId}</if>
-            <if test="userType != null "> and fs_course_watch_comment.user_type = #{userType}</if>
-            <if test="courseId != null "> and fs_course_watch_comment.course_id = #{courseId}</if>
-            <if test="videoId != null "> and fs_course_watch_comment.video_id = #{videoId}</if>
-            <if test="type != null "> and fs_course_watch_comment.type = #{type}</if>
-            <if test="parentId != null "> and fs_course_watch_comment.parent_id = #{parentId}</if>
-            <if test="content != null  and content != ''"> and fs_course_watch_comment.content = #{content}</if>
-            <if test="isRevoke != null "> and fs_course_watch_comment.is_revoke = #{isRevoke}</if>
             <if test="nickName != null and nickName != '' ">and fs_user.nick_name like concat('%', #{nickName}, '%')</if>
+            <if test="isAll != null and isAll == true and keywords != null and keywords !='' ">
+                AND (fs_user.nickname LIKE concat('%',#{keywords},'%')
+                or  fs_user_course.course_name LIKE concat('%',#{keywords},'%')
+                or  fs_user_course_video.title LIKE concat('%',#{keywords},'%')
+                )
+            </if>
         </where>
     </select>