Ver código fonte

feat:管理端课程查看评论列表

caoliqin 4 dias atrás
pai
commit
88872460fa

+ 14 - 7
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchCommentController.java

@@ -1,6 +1,11 @@
 package com.fs.course.controller;
 
 import java.util.List;
+
+import com.fs.common.core.domain.R;
+import com.fs.course.vo.FsCourseWatchCommentListVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -22,7 +27,7 @@ import com.fs.common.core.page.TableDataInfo;
 
 /**
  * 看课评论Controller
- * 
+ *
  * @author fs
  * @date 2025-05-26
  */
@@ -38,11 +43,13 @@ public class FsCourseWatchCommentController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('course:courseWatchComment:list')")
     @GetMapping("/list")
-    public TableDataInfo list(FsCourseWatchComment fsCourseWatchComment)
+    public R list(FsCourseWatchComment fsCourseWatchComment)
     {
-        startPage();
-        List<FsCourseWatchComment> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchComment);
-        return getDataTable(list);
+//        startPage();
+        PageHelper.startPage(fsCourseWatchComment.getPageNum(), fsCourseWatchComment.getPageSize());
+        List<FsCourseWatchCommentListVO> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchComment);
+        PageInfo<FsCourseWatchCommentListVO> pageInfo = new PageInfo<>(list);
+        return R.ok().put("rows", pageInfo);
     }
 
     /**
@@ -53,8 +60,8 @@ public class FsCourseWatchCommentController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsCourseWatchComment fsCourseWatchComment)
     {
-        List<FsCourseWatchComment> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchComment);
-        ExcelUtil<FsCourseWatchComment> util = new ExcelUtil<FsCourseWatchComment>(FsCourseWatchComment.class);
+        List<FsCourseWatchCommentListVO> list = fsCourseWatchCommentService.selectFsCourseWatchCommentList(fsCourseWatchComment);
+        ExcelUtil<FsCourseWatchCommentListVO> util = new ExcelUtil<FsCourseWatchCommentListVO>(FsCourseWatchCommentListVO.class);
         return util.exportExcel(list, "看课评论数据");
     }
 

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

@@ -1,5 +1,6 @@
 package com.fs.course.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fs.common.annotation.Excel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -16,6 +17,18 @@ 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;
 

+ 2 - 1
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.vo.FsCourseWatchCommentListVO;
 import com.fs.course.vo.FsCourseWatchCommentVO;
 import org.apache.ibatis.annotations.Update;
 
@@ -28,7 +29,7 @@ public interface FsCourseWatchCommentMapper extends BaseMapper<FsCourseWatchComm
      * @param fsCourseWatchComment 看课评论
      * @return 看课评论集合
      */
-    List<FsCourseWatchComment> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment);
+    List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment);
 
     /**
      * 新增看课评论

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

@@ -6,6 +6,7 @@ import com.fs.common.core.domain.R;
 import com.fs.course.domain.FsCourseWatchComment;
 import com.fs.course.param.FsCourseWatchCommentListParam;
 import com.fs.course.param.FsCourseWatchCommentSaveParam;
+import com.fs.course.vo.FsCourseWatchCommentListVO;
 import com.fs.course.vo.FsCourseWatchCommentVO;
 
 /**
@@ -29,7 +30,7 @@ public interface IFsCourseWatchCommentService extends IService<FsCourseWatchComm
      * @param fsCourseWatchComment 看课评论
      * @return 看课评论集合
      */
-    List<FsCourseWatchComment> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment);
+    List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment);
 
     /**
      * 新增看课评论

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

@@ -10,6 +10,7 @@ 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.FsCourseWatchCommentSaveParam;
+import com.fs.course.vo.FsCourseWatchCommentListVO;
 import com.fs.course.vo.FsCourseWatchCommentVO;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.system.domain.SysKeyword;
@@ -64,7 +65,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
      * @return 看课评论
      */
     @Override
-    public List<FsCourseWatchComment> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment)
+    public List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchComment fsCourseWatchComment)
     {
         return baseMapper.selectFsCourseWatchCommentList(fsCourseWatchComment);
     }

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

@@ -0,0 +1,52 @@
+package com.fs.course.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@ApiModel(value = "评论列表-管理端")
+public class FsCourseWatchCommentListVO {
+
+    @ApiModelProperty(value = "评论id")
+    private Long commentId;
+
+    @ApiModelProperty(value = "用户id")
+    private Long userId;
+
+    @Excel(name = "用户名称")
+    @ApiModelProperty(value = "用户名称")
+    private String nickName;
+
+    @ApiModelProperty(value = "课程id")
+    private Long courseId;
+
+    @ApiModelProperty(value = "视频id")
+    private Long videoId;
+
+    @Excel(name = "评论内容", width = 120)
+    @ApiModelProperty(value = "评论内容")
+    private String content;
+
+    @Excel(name = "评论时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "评论时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @ApiModelProperty(value = "时间(用于弹幕记录时间)")
+    private Integer time;
+
+    @ApiModelProperty(value = "字体大小")
+    private String fontSize;
+
+    @ApiModelProperty(value = "展示模式")
+    private String mode;
+
+    @ApiModelProperty(value = "字体颜色")
+    private String color;
+
+}

+ 30 - 10
fs-service/src/main/resources/mapper/course/FsCourseWatchCommentMapper.xml

@@ -27,17 +27,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                font_size, mode, color from fs_course_watch_comment
     </sql>
 
-    <select id="selectFsCourseWatchCommentList" parameterType="FsCourseWatchComment" resultMap="FsCourseWatchCommentResult">
-        <include refid="selectFsCourseWatchCommentVo"/>
+    <select id="selectFsCourseWatchCommentList" resultType="com.fs.course.vo.FsCourseWatchCommentListVO">
+        SELECT
+        fs_course_watch_comment.comment_id,
+        fs_course_watch_comment.user_id,
+        fs_course_watch_comment.user_type,
+        fs_course_watch_comment.course_id,
+        fs_course_watch_comment.video_id,
+        fs_course_watch_comment.type,
+        fs_course_watch_comment.parent_id,
+        fs_course_watch_comment.content,
+        fs_course_watch_comment.create_time,
+        fs_course_watch_comment.update_time,
+        fs_course_watch_comment.is_revoke,
+        fs_course_watch_comment.`time`,
+        fs_course_watch_comment.font_size,
+        fs_course_watch_comment.`mode`,
+        fs_course_watch_comment.color,
+        fs_user.nick_name
+        FROM
+        fs_course_watch_comment
+        LEFT JOIN fs_user ON fs_user.user_id = fs_course_watch_comment.user_id
         <where>
-            <if test="userId != null "> and user_id = #{userId}</if>
-            <if test="userType != null "> and user_type = #{userType}</if>
-            <if test="courseId != null "> and course_id = #{courseId}</if>
-            <if test="videoId != null "> and video_id = #{videoId}</if>
-            <if test="type != null "> and type = #{type}</if>
-            <if test="parentId != null "> and parent_id = #{parentId}</if>
-            <if test="content != null  and content != ''"> and content = #{content}</if>
-            <if test="isRevoke != null "> and is_revoke = #{isRevoke}</if>
+            <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>
         </where>
     </select>