From f2cc79e9e83aafacc1af0e2c86e3c8df384fc895 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 27 五月 2025 19:27:22 +0800
Subject: [PATCH] 视频评论功能代码

---
 framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoCommentQuery.java       |   32 ++
 framework/src/main/java/cn/lili/modules/lmk/service/VideoCommentService.java          |   66 +++++
 framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml                        |  105 ++++++++
 framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoComment.java           |   56 ++++
 framework/src/main/java/cn/lili/modules/lmk/mapper/VideoCommentMapper.java            |   50 ++++
 framework/src/main/java/cn/lili/common/sensitive/SensitiveWordsFilter.java            |   11 
 framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoCommentServiceImpl.java |  147 ++++++++++++
 framework/src/main/java/cn/lili/modules/lmk/enums/general/VideoCommentStatusEnum.java |   47 +++
 framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoCommentForm.java         |   57 ++++
 buyer-api/src/main/java/cn/lili/controller/lmk/VideoCommentController.java            |   77 ++++++
 framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoCommentVO.java             |   63 +++++
 11 files changed, 711 insertions(+), 0 deletions(-)

diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/VideoCommentController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/VideoCommentController.java
new file mode 100644
index 0000000..81ce413
--- /dev/null
+++ b/buyer-api/src/main/java/cn/lili/controller/lmk/VideoCommentController.java
@@ -0,0 +1,77 @@
+package cn.lili.controller.lmk;
+
+import cn.lili.group.Update;
+import cn.lili.group.Add;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import lombok.RequiredArgsConstructor;
+import java.util.List;
+import org.springframework.validation.annotation.Validated;
+import javax.validation.constraints.NotEmpty;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import cn.lili.modules.lmk.service.VideoCommentService;
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.form.VideoCommentForm;
+import cn.lili.modules.lmk.domain.query.VideoCommentQuery;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 瑙嗛璇勮 鍓嶇鎺у埗鍣�
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Validated
+@RequiredArgsConstructor
+@Api(value = "瑙嗛璇勮", tags = "瑙嗛璇勮绠$悊")
+@RestController
+@RequestMapping("/buyer/lmk/video-comment")
+public class VideoCommentController {
+
+    private final VideoCommentService videoCommentService;
+
+    @PostMapping("/comment")
+    @ApiOperation(value = "璇勮", notes = "璇勮")
+    public Result comment(@RequestBody @Validated(Add.class) VideoCommentForm form) {
+        return videoCommentService.comment(form);
+    }
+
+    @GetMapping("/wx/page")
+    @ApiOperation(value = "灏忕▼搴忓垎椤�", notes = "璇勮")
+    public Result wxPage(VideoCommentQuery query) {
+        return videoCommentService.wxPage(query);
+    }
+
+
+    @DeleteMapping("/{id}")
+    @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎")
+    public Result removeById(@PathVariable("id") String id) {
+        return videoCommentService.removeById(id);
+    }
+
+    @DeleteMapping("/batch")
+    @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎")
+    public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) {
+        return videoCommentService.remove(ids);
+    }
+
+    @GetMapping("/page")
+    @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉")
+    public Result page(VideoCommentQuery query) {
+        return videoCommentService.page(query);
+    }
+
+    @GetMapping("/{id}")
+    @ApiOperation(value = "璇︽儏", notes = "璇︽儏")
+    public Result detail(@PathVariable("id") String id) {
+        return videoCommentService.detail(id);
+    }
+
+    @GetMapping("/list")
+    @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃")
+    public Result list() {
+        return videoCommentService.all();
+    }
+}
diff --git a/framework/src/main/java/cn/lili/common/sensitive/SensitiveWordsFilter.java b/framework/src/main/java/cn/lili/common/sensitive/SensitiveWordsFilter.java
index 99acf87..1a57ec5 100644
--- a/framework/src/main/java/cn/lili/common/sensitive/SensitiveWordsFilter.java
+++ b/framework/src/main/java/cn/lili/common/sensitive/SensitiveWordsFilter.java
@@ -53,6 +53,17 @@
     }
 
     /**
+     * 鍒ゆ柇鍐呭鏄惁鍖呭惈鏁忔劅璇嶏紝濡傛灉涓嶅寘鍚� filter鏂规硶浼氬師灏佷笉鍔ㄧ殑杩斿洖
+     *
+     * @param content
+     * @return true:鍖呭惈  false锛氫笉鍖呭惈
+     */
+    public static Boolean includeSentenceWord(String content) {
+        String filter = filter(content, WILDCARD_STAR);
+        return !content.equals(filter);
+    }
+
+    /**
      * 瀵瑰彞瀛愯繘琛屾晱鎰熻瘝杩囨护<br/>
      * 濡傛灉鏃犳晱鎰熻瘝杩斿洖杈撳叆鐨剆entence瀵硅薄锛屽嵆鍙互鐢ㄤ笅闈㈢殑鏂瑰紡鍒ゆ柇鏄惁鏈夋晱鎰熻瘝锛�<br/>
      *
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoComment.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoComment.java
new file mode 100644
index 0000000..7042c38
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoComment.java
@@ -0,0 +1,56 @@
+package cn.lili.modules.lmk.domain.entity;
+
+import cn.lili.mybatis.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 瑙嗛璇勮
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Data
+@TableName("lmk_video_comment")
+public class VideoComment extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("video_id")
+    /** 瑙嗛id */
+    private String videoId;
+
+    @TableField("comment_content")
+    /** 璇勮鍐呭 */
+    private String commentContent;
+
+    @TableField("reply_id")
+    /** 鍥炲鐨勮瘎璁篿d */
+    private String replyId;
+
+    @TableField("reply_user_id")
+    /** 琚洖澶嶄汉id */
+    private String replyUserId;
+
+    @TableField("reply_user_nickname")
+    /** 琚洖澶嶄汉鏄电О */
+    private String replyUserNickname;
+
+    @TableField("master_comment_id")
+    /** 涓昏瘎璁篿d */
+    private String masterCommentId;
+
+    @TableField("status")
+    /** 璇勮鐘舵�� */
+    private String status;
+
+    @TableField("user_nickname")
+    /** 璇勮浜烘樀绉� */
+    private String userNickname;
+
+    @TableField("user_avatar")
+    /** 璇勮浜哄ご鍍� */
+    private String userAvatar;
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoCommentForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoCommentForm.java
new file mode 100644
index 0000000..48dc822
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoCommentForm.java
@@ -0,0 +1,57 @@
+package cn.lili.modules.lmk.domain.form;
+
+import cn.lili.group.Update;
+import cn.lili.group.Add;
+import cn.lili.base.AbsForm;
+import cn.lili.modules.lmk.domain.entity.VideoComment;
+import org.springframework.beans.BeanUtils;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import org.springframework.lang.NonNull;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * 瑙嗛璇勮琛ㄥ崟
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Data
+@ApiModel(value = "VideoComment琛ㄥ崟", description = "瑙嗛璇勮琛ㄥ崟")
+public class VideoCommentForm extends AbsForm {
+
+    @NotBlank(message = "瑙嗛id涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("瑙嗛id")
+    private String videoId;
+
+    @Max(value = 1000, message = "璇勮鍐呭杩囬暱")
+    @NotBlank(message = "璇勮鍐呭涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("璇勮鍐呭")
+    private String commentContent;
+
+    @ApiModelProperty("鍥炲鐨勮瘎璁篿d")
+    private String replyId;
+
+    @ApiModelProperty("鍥炲鐨勪汉")
+    private String replyUserId;
+
+    @ApiModelProperty("鍥炲鐨勪汉鏄电О")
+    private String replyUserNickname;
+
+    @ApiModelProperty("涓昏瘎璁篿d锛屽彲浠巖eply鐨勮瘎璁轰笂鑾峰彇鍒�")
+    private String masterCommentId;
+
+    public static VideoComment getEntityByForm(@NonNull VideoCommentForm form, VideoComment entity) {
+        if(entity == null) {
+          entity = new VideoComment();
+        }
+        BeanUtils.copyProperties(form, entity);
+        return entity;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoCommentQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoCommentQuery.java
new file mode 100644
index 0000000..3756e9e
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoCommentQuery.java
@@ -0,0 +1,32 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import java.util.List;
+import org.springframework.lang.NonNull;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 瑙嗛璇勮鏌ヨ
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Data
+@ApiModel(value = "VideoComment鏌ヨ鍙傛暟", description = "瑙嗛璇勮鏌ヨ鍙傛暟")
+public class VideoCommentQuery extends AbsQuery {
+
+    @ApiModelProperty("瑙嗛id")
+    private String videoId;
+
+    @ApiModelProperty("鏄惁鏄姞杞芥洿澶氬瓙璇勮锛屽嵆鏌ュ瓙璇勮鍒嗛〉")
+    private String masterCommentId;
+
+    @ApiModelProperty(hidden = true)
+    private String replyId;
+
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoCommentVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoCommentVO.java
new file mode 100644
index 0000000..2673cad
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoCommentVO.java
@@ -0,0 +1,63 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.VideoComment;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import org.springframework.lang.NonNull;
+import org.springframework.beans.BeanUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * 瑙嗛璇勮灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Data
+@ApiModel(value = "瑙嗛璇勮鍝嶅簲鏁版嵁", description = "瑙嗛璇勮鍝嶅簲鏁版嵁")
+public class VideoCommentVO extends AbsVo {
+
+    /** 瑙嗛id */
+    @ApiModelProperty("瑙嗛id")
+    private String videoId;
+
+    /** 璇勮鍐呭 */
+    @ApiModelProperty("璇勮鍐呭")
+    private String commentContent;
+
+    /** 鍥炲鐨勮瘎璁篿d锛屽嵆parentId */
+    @ApiModelProperty("鍥炲鐨勮瘎璁篿d")
+    private String replyId;
+    private String replyUserId;
+    private String replyUserNickname;
+
+    @ApiModelProperty("涓昏瘎璁篿d")
+    private String masterCommentId;
+
+    /** 璇勮鐘舵�� */
+    @ApiModelProperty("璇勮鐘舵��")
+    private String status;
+
+    @ApiModelProperty("璇勮浜篿d")
+    private String userId;
+
+    @ApiModelProperty("璇勮浜烘樀绉�")
+    private String userNickname;
+
+    @ApiModelProperty("璇勮浜哄ご鍍�")
+    private String userAvatar;
+
+    public static VideoCommentVO getVoByEntity(@NonNull VideoComment entity, VideoCommentVO vo) {
+        if(vo == null) {
+            vo = new VideoCommentVO();
+        }
+        BeanUtils.copyProperties(entity, vo);
+        return vo;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/enums/general/VideoCommentStatusEnum.java b/framework/src/main/java/cn/lili/modules/lmk/enums/general/VideoCommentStatusEnum.java
new file mode 100644
index 0000000..5a9ac78
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/enums/general/VideoCommentStatusEnum.java
@@ -0,0 +1,47 @@
+package cn.lili.modules.lmk.enums.general;
+
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 瑙嗛璇勮鐘舵��
+ *
+ * @author锛歺p
+ * @date锛�2025/5/14 10:30
+ */
+@Getter
+public enum VideoCommentStatusEnum {
+
+    NORMAL("normal", "姝e父"),
+    AUDITING("auditing", "瀹℃牳涓�"),
+    INVALID("invalid", "鏃犳晥鐨�/鏈�氳繃瀹℃牳鐨�"),
+    ;
+
+    private final String value;
+
+
+    private final String desc;
+
+    VideoCommentStatusEnum(String value, String desc) {
+        this.value = value;
+        this.desc = desc;
+    }
+
+    /**
+     * 鑾峰彇鍚箟
+     *
+     * @param value
+     * @return
+     */
+    public static String getDescByValue(String value) {
+        if (StringUtils.isBlank(value)) {
+            return null;
+        }
+        for (VideoCommentStatusEnum e : VideoCommentStatusEnum.values()){
+            if (value.equals(e.getValue())) {
+                return e.getDesc();
+            }
+        }
+        return null;
+    }
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoCommentMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoCommentMapper.java
new file mode 100644
index 0000000..81749f8
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoCommentMapper.java
@@ -0,0 +1,50 @@
+package cn.lili.modules.lmk.mapper;
+
+import cn.lili.modules.lmk.domain.entity.VideoComment;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import cn.lili.modules.lmk.domain.vo.VideoCommentVO;
+import cn.lili.modules.lmk.domain.form.VideoCommentForm;
+import cn.lili.modules.lmk.domain.query.VideoCommentQuery;
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 瑙嗛璇勮 Mapper 鎺ュ彛
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Mapper
+public interface VideoCommentMapper extends BaseMapper<VideoComment> {
+
+    /**
+     * id鏌ユ壘瑙嗛璇勮
+     * @param id
+     * @return
+     */
+    VideoCommentVO getById(String id);
+
+    /**
+    *  鍒嗛〉
+    */
+    IPage getPage(IPage page, @Param("query") VideoCommentQuery query);
+
+    /**
+     * 灏忕▼搴忎富璇勮鍒嗛〉鏌ヨ
+     *
+     * @param page
+     * @param query
+     * @return
+     */
+    IPage masterCommentPage(IPage page, @Param("query") VideoCommentQuery query);
+
+    /**
+     * 灏忕▼搴忓洖澶嶈瘎璁哄垎椤垫煡璇�
+     *
+     * @param page
+     * @param query
+     */
+    IPage replyCommentPage(IPage page, @Param("query") VideoCommentQuery query);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/VideoCommentService.java b/framework/src/main/java/cn/lili/modules/lmk/service/VideoCommentService.java
new file mode 100644
index 0000000..09e62bf
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/VideoCommentService.java
@@ -0,0 +1,66 @@
+package cn.lili.modules.lmk.service;
+
+import cn.lili.modules.lmk.domain.entity.VideoComment;
+import com.baomidou.mybatisplus.extension.service.IService;
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.form.VideoCommentForm;
+import cn.lili.modules.lmk.domain.query.VideoCommentQuery;
+import java.util.List;
+
+/**
+ * 瑙嗛璇勮 鏈嶅姟绫�
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+public interface VideoCommentService extends IService<VideoComment> {
+
+    /**
+     * 娣诲姞
+     * @param form
+     * @return
+     */
+    Result comment(VideoCommentForm form);
+
+    /**
+     * 鎵归噺鍒犻櫎
+     * @param ids
+     * @return
+     */
+    Result remove(List<String> ids);
+
+    /**
+     * id鍒犻櫎
+     * @param id
+     * @return
+     */
+    Result removeById(String id);
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param query
+     * @return
+     */
+    Result page(VideoCommentQuery query);
+
+    /**
+     * 鏍规嵁id鏌ユ壘
+     * @param id
+     * @return
+     */
+    Result detail(String id);
+
+    /**
+     * 鍒楄〃
+     * @return
+     */
+    Result all();
+
+    /**
+     * 灏忕▼搴忔煡瑙嗛璇勮
+     *
+     * @param query
+     * @return
+     */
+    Result wxPage(VideoCommentQuery query);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoCommentServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoCommentServiceImpl.java
new file mode 100644
index 0000000..3874f5d
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoCommentServiceImpl.java
@@ -0,0 +1,147 @@
+package cn.lili.modules.lmk.service.impl;
+
+import cn.lili.common.security.AuthUser;
+import cn.lili.common.security.context.UserContext;
+import cn.lili.common.sensitive.SensitiveWordsFilter;
+import cn.lili.modules.lmk.enums.general.VideoCommentStatusEnum;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import cn.lili.modules.lmk.domain.entity.VideoComment;
+import cn.lili.modules.lmk.mapper.VideoCommentMapper;
+import cn.lili.modules.lmk.service.VideoCommentService;
+import cn.lili.base.Result;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.lili.modules.lmk.domain.form.VideoCommentForm;
+import cn.lili.modules.lmk.domain.vo.VideoCommentVO;
+import cn.lili.modules.lmk.domain.query.VideoCommentQuery;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+import cn.lili.utils.PageUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 瑙嗛璇勮 鏈嶅姟瀹炵幇绫�
+ *
+ * @author xp
+ * @since 2025-05-27
+ */
+@Service
+@RequiredArgsConstructor
+public class VideoCommentServiceImpl extends ServiceImpl<VideoCommentMapper, VideoComment> implements VideoCommentService {
+
+    private final VideoCommentMapper videoCommentMapper;
+
+    /**
+     * 娣诲姞
+     * @param form
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result comment(VideoCommentForm form) {
+        // 鐩戞祴鍐呭鏄惁鍖呭惈鏁忔劅璇�
+        if (SensitiveWordsFilter.includeSentenceWord(form.getCommentContent())) {
+            return Result.error("璇勮鍚晱鎰熷唴瀹�");
+        }
+        if (StringUtils.isNotBlank(form.getReplyId())) {
+            VideoComment beReplyComment = baseMapper.selectById(form.getReplyId());
+            if (Objects.isNull(beReplyComment)) {
+                throw new RuntimeException("鎮ㄥ洖澶嶇殑璇勮宸茶鍒犻櫎");
+            } else if (VideoCommentStatusEnum.INVALID.getValue().equals(beReplyComment.getStatus())) {
+                throw new RuntimeException("鎮ㄥ洖澶嶇殑璇勮宸插け鏁�");
+            }
+        }
+        VideoComment entity = VideoCommentForm.getEntityByForm(form, null);
+        entity.setStatus(VideoCommentStatusEnum.AUDITING.getValue());
+
+        AuthUser currentUser = UserContext.getCurrentUser();
+        entity.setUserNickname(currentUser.getNickName());
+        entity.setUserAvatar(currentUser.getFace());
+
+        baseMapper.insert(entity);
+        if (StringUtils.isBlank(entity.getReplyId())) {
+            // 涓嶆槸鍥炲璇勮锛岄偅涔堝氨鏄富璇勮锛屼富璇勮鐨刴asterId璁剧疆涓鸿嚜宸辩殑id
+            entity.setMasterCommentId(entity.getId());
+        }
+        baseMapper.updateById(entity);
+        return Result.ok("娣诲姞鎴愬姛");
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     * @param ids
+     * @return
+     */
+    @Override
+    public Result remove(List<String> ids) {
+        baseMapper.deleteBatchIds(ids);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * id鍒犻櫎
+     * @param id
+     * @return
+     */
+    @Override
+    public Result removeById(String id) {
+        baseMapper.deleteById(id);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param query
+     * @return
+     */
+    @Override
+    public Result page(VideoCommentQuery query) {
+        IPage<VideoCommentVO> page = PageUtil.getPage(query, VideoCommentVO.class);
+        baseMapper.getPage(page, query);
+        return Result.ok().data(page.getRecords()).total(page.getTotal());
+    }
+
+    /**
+     * 鏍规嵁id鏌ユ壘
+     * @param id
+     * @return
+     */
+    @Override
+    public Result detail(String id) {
+        VideoCommentVO vo = baseMapper.getById(id);
+        Assert.notNull(vo, "璁板綍涓嶅瓨鍦�");
+        return Result.ok().data(vo);
+    }
+
+    /**
+     * 鍒楄〃
+     * @return
+     */
+    @Override
+    public Result all() {
+        List<VideoComment> entities = baseMapper.selectList(null);
+        List<VideoCommentVO> vos = entities.stream()
+                .map(entity -> VideoCommentVO.getVoByEntity(entity, null))
+                .collect(Collectors.toList());
+        return Result.ok().data(vos);
+    }
+
+    @Override
+    public Result wxPage(VideoCommentQuery query) {
+        IPage<VideoCommentVO> page = PageUtil.getPage(query, VideoCommentVO.class);
+        if (StringUtils.isNotBlank(query.getMasterCommentId())) {
+            // 鍔犺浇瀛愯瘎璁虹殑鎯呭喌
+            baseMapper.replyCommentPage(page, query);
+        } else {
+            // 鍔犺浇涓昏瘎璁虹殑鎯呭喌銆備富璇勮id = masterCommentId
+            baseMapper.masterCommentPage(page, query);
+        }
+        return Result.ok().data(page.getRecords());
+    }
+}
diff --git a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
new file mode 100644
index 0000000..365fe5b
--- /dev/null
+++ b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.lili.modules.lmk.mapper.VideoCommentMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.VideoCommentVO">
+        <id column="id" property="id"/>
+        <result column="video_id" property="videoId" />
+        <result column="comment_content" property="commentContent" />
+        <result column="reply_id" property="replyId" />
+        <result column="reply_user_id" property="replyUserId" />
+        <result column="reply_user_nickname" property="replyUserNickname" />
+        <result column="master_comment_id" property="masterCommentId" />
+        <result column="status" property="status" />
+        <result column="create_by" property="userId" />
+        <result column="user_nickname" property="userNickname" />
+        <result column="user_avatar" property="userAvatar" />
+    </resultMap>
+
+
+
+
+
+
+
+    <select id="getById" resultMap="BaseResultMap">
+        SELECT
+            LVC.video_id,
+            LVC.comment_content,
+            LVC.reply_id,
+            LVC.master_comment_id,
+            LVC.status,
+            LVC.id
+        FROM
+            lmk_video_comment LVC
+        WHERE
+            LVC.id = #{id} AND LVC.delete_flag = 0
+    </select>
+
+
+    <select id="getPage" resultMap="BaseResultMap">
+        SELECT
+            LVC.video_id,
+            LVC.comment_content,
+            LVC.reply_id,
+            LVC.master_comment_id,
+            LVC.status,
+            LVC.id
+        FROM
+            lmk_video_comment LVC
+        WHERE
+            LVC.delete_flag = 0
+    </select>
+
+
+    <select id="masterCommentPage" resultMap="BaseResultMap">
+        SELECT
+            LVC.video_id,
+            LVC.comment_content,
+            LVC.reply_id,
+            LVC.reply_user_id,
+            LVC.reply_user_nickname,
+            LVC.master_comment_id,
+            LVC.status,
+            LVC.id,
+            LVC.create_by,
+            LVC.user_nickname,
+            LVC.user_avatar
+        FROM
+             lmk_video_comment LVC
+        WHERE
+              LVC.id = LVC.master_comment_id
+              AND LVC.video_id = #{query.videoId}
+              AND LVC.status = 'normal'
+              AND LVC.delete_flag = 0
+        ORDER BY
+            LVC.create_time DESC
+    </select>
+
+    <select id="replyCommentPage" resultMap="BaseResultMap">
+        SELECT
+            LVC.video_id,
+            LVC.comment_content,
+            LVC.reply_id,
+            LVC.reply_user_id,
+            LVC.reply_user_nickname,
+            LVC.master_comment_id,
+            LVC.status,
+            LVC.id,
+            LVC.create_by,
+            LVC.user_nickname,
+            LVC.user_avatar
+        FROM
+            lmk_video_comment LVC
+        WHERE
+              LVC.id = LVC.master_comment_id
+              AND LVC.video_id = #{query.videoId}
+              AND LVC.master_comment_id = #{query.masterCommentId}
+              AND LVC.status = 'normal'
+              AND LVC.delete_flag = 0
+        ORDER BY
+            LVC.create_time ASC
+    </select>
+
+</mapper>

--
Gitblit v1.8.0