From 2502b12e05029149f0cd5aea6c25bc419520cc4f Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 03 六月 2025 11:43:24 +0800
Subject: [PATCH] 视频主页部分接口

---
 framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoAccountServiceImpl.java |   22 +++
 framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoAccountVO.java             |   60 ++++++++++
 framework/src/main/java/cn/lili/modules/lmk/domain/query/AuthorVideoQuery.java        |   22 +++
 framework/src/main/java/cn/lili/modules/lmk/mapper/VideoAccountMapper.java            |   21 +++
 framework/src/main/resources/mapper/lmk/VideoMapper.xml                               |   55 +++++++++
 framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoAccount.java           |   30 +++++
 framework/src/main/resources/mapper/lmk/VideoAccountMapper.xml                        |   41 ++++++
 buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java                   |   13 ++
 framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java                 |   17 ++
 framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java        |   22 +++
 framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java                   |   35 +++++
 framework/src/main/java/cn/lili/modules/lmk/service/VideoAccountService.java          |   17 ++
 12 files changed, 355 insertions(+), 0 deletions(-)

diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
index 9fb330c..f9ad281 100644
--- a/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
+++ b/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
@@ -4,6 +4,7 @@
 import cn.lili.group.Update;
 import cn.lili.group.Add;
 import cn.lili.modules.lmk.domain.form.VideoFootPrintForm;
+import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
 import cn.lili.modules.member.entity.dos.FootPrint;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -77,4 +78,16 @@
     public Result saveViewRecord(@RequestBody VideoFootPrintForm form) {
         return videoService.saveViewRecord(form);
     }
+
+    @GetMapping("/author-info/{authorId}")
+    @ApiOperation(value = "鑾峰彇瑙嗛涓婚〉浣滆�呬俊鎭�", notes = "鑾峰彇瑙嗛涓婚〉浣滆�呬俊鎭�")
+    public Result getAuthorInfo(@PathVariable("authorId") String authorId) {
+        return videoService.getAuthorInfo(authorId);
+    }
+
+    @GetMapping("/author-video-page")
+    @ApiOperation(value = "鑾峰彇瑙嗛涓婚〉浣滆�呰棰戝垎椤�", notes = "鑾峰彇瑙嗛涓婚〉浣滆�呰棰戝垎椤�")
+    public Result getAuthorVideoPage(AuthorVideoQuery query) {
+        return videoService.getAuthorVideoPage(query);
+    }
 }
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoAccount.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoAccount.java
new file mode 100644
index 0000000..afb3c5d
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoAccount.java
@@ -0,0 +1,30 @@
+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-06-03
+ */
+@Data
+@TableName("lmk_video_account")
+public class VideoAccount extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("user_id")
+    /** memberId */
+    private String userId;
+
+    @TableField("motto")
+    /** 搴у彸閾� */
+    private String motto;
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/AuthorVideoQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/AuthorVideoQuery.java
new file mode 100644
index 0000000..c0f168e
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/AuthorVideoQuery.java
@@ -0,0 +1,22 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 瑙嗛鍐呭鏌ヨ
+ *
+ * @author xp
+ * @since 2025-05-16
+ */
+@Data
+@ApiModel(value = "Video鏌ヨ鍙傛暟", description = "瑙嗛鍐呭鏌ヨ鍙傛暟")
+public class AuthorVideoQuery extends AbsQuery {
+
+    @ApiModelProperty("浣滆�卛d")
+    private String authorId;
+
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoAccountVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoAccountVO.java
new file mode 100644
index 0000000..979e899
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoAccountVO.java
@@ -0,0 +1,60 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.VideoAccount;
+import java.util.List;
+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-06-03
+ */
+@Data
+@ApiModel(value = "瑙嗛璐﹀彿淇℃伅鍝嶅簲鏁版嵁", description = "瑙嗛璐﹀彿淇℃伅鍝嶅簲鏁版嵁")
+public class VideoAccountVO extends AbsVo {
+
+    /** memberId */
+    @ApiModelProperty("memberId")
+    private String userId;
+
+    @ApiModelProperty("鏄电О")
+    private String nickName;
+
+    @ApiModelProperty("澶村儚")
+    private String avatar;
+
+    /** 搴у彸閾� */
+    @ApiModelProperty("搴у彸閾�")
+    private String motto;
+
+    @ApiModelProperty("绮変笣鏁�")
+    private Long fansNum;
+
+    @ApiModelProperty("鍏虫敞鏁�")
+    private Long subNum;
+
+    @ApiModelProperty("鑾疯禐鏁�")
+    private Long likeNum;
+
+    @ApiModelProperty("鏄惁鏄嚜宸辨煡鐪嬭嚜宸辩殑涓婚〉")
+    private Boolean self;
+
+    @ApiModelProperty("鏄惁鍏虫敞浜�")
+    private Boolean hasSub;
+
+    public static VideoAccountVO getVoByEntity(@NonNull VideoAccount entity, VideoAccountVO vo) {
+        if(vo == null) {
+            vo = new VideoAccountVO();
+        }
+        BeanUtils.copyProperties(entity, vo);
+        return vo;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoAccountMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoAccountMapper.java
new file mode 100644
index 0000000..f9244cb
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoAccountMapper.java
@@ -0,0 +1,21 @@
+package cn.lili.modules.lmk.mapper;
+
+import cn.lili.modules.lmk.domain.entity.VideoAccount;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import cn.lili.modules.lmk.domain.vo.VideoAccountVO;
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 瑙嗛璐﹀彿淇℃伅 Mapper 鎺ュ彛
+ *
+ * @author xp
+ * @since 2025-06-03
+ */
+@Mapper
+public interface VideoAccountMapper extends BaseMapper<VideoAccount> {
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
index 28854b7..0839f17 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
@@ -1,8 +1,11 @@
 package cn.lili.modules.lmk.mapper;
 
 import cn.lili.modules.lmk.domain.entity.Video;
+import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
 import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
 import cn.lili.modules.lmk.domain.vo.CollectTypeNumVO;
+import cn.lili.modules.lmk.domain.vo.VideoAccountVO;
+import cn.lili.modules.lmk.domain.vo.WxVideoVO;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import cn.lili.modules.lmk.domain.vo.VideoVO;
@@ -61,4 +64,36 @@
      * @param numList
      */
     void updateCommentNumBatch(@Param("list") List<CollectTypeNumVO> numList);
+
+    /**
+     * 瑙嗛涓婚〉浣滆�呬俊鎭�
+     *
+     * @param authorId
+     * @return
+     */
+    VideoAccountVO getAuthorInfo(@Param("authorId") String authorId, @Param("currentUserId") String currentUserId);
+
+    /**
+     * 鑾峰彇浣滆�呯殑鎵�鏈夎棰慽d
+     *
+     * @param authorId
+     * @return
+     */
+    List<String> getVideoIdsByAuthor(@Param("authorId") String authorId);
+
+    /**
+     * 鑾峰彇浣滆�呮墍鏈夎棰戠殑鏀惰棌鏁颁箣鍜�
+     *
+     * @param videoIds
+     * @return
+     */
+    Long countAuthorVideoCollectNum(@Param("videoIds") List<String> videoIds);
+
+    /**
+     * 鑾峰彇瑙嗛涓婚〉-浣滆�呰棰戠殑鍒嗛〉
+     *
+     * @param page
+     * @param query
+     */
+    IPage getAuthorVideoPage(IPage page, @Param("query") AuthorVideoQuery query);
 }
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/VideoAccountService.java b/framework/src/main/java/cn/lili/modules/lmk/service/VideoAccountService.java
new file mode 100644
index 0000000..63355e3
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/VideoAccountService.java
@@ -0,0 +1,17 @@
+package cn.lili.modules.lmk.service;
+
+import cn.lili.modules.lmk.domain.entity.VideoAccount;
+import com.baomidou.mybatisplus.extension.service.IService;
+import cn.lili.base.Result;
+import java.util.List;
+
+/**
+ * 瑙嗛璐﹀彿淇℃伅 鏈嶅姟绫�
+ *
+ * @author xp
+ * @since 2025-06-03
+ */
+public interface VideoAccountService extends IService<VideoAccount> {
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java b/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
index 38011b9..de396a9 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
@@ -3,6 +3,7 @@
 import cn.lili.base.AbsQuery;
 import cn.lili.modules.lmk.domain.entity.Video;
 import cn.lili.modules.lmk.domain.form.*;
+import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
 import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
 import cn.lili.modules.lmk.domain.vo.CollectTypeNumVO;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -142,4 +143,20 @@
      * @return
      */
     Result saveViewRecord(VideoFootPrintForm form);
+
+    /**
+     * 鑾峰彇瑙嗛涓婚〉浣滆�呬俊鎭�
+     *
+     * @param authorId
+     * @return
+     */
+    Result getAuthorInfo(String authorId);
+
+    /**
+     * 鑾峰彇瑙嗛涓婚〉浣滆�呰棰戝垎椤�
+     *
+     * @param query
+     * @return
+     */
+    Result getAuthorVideoPage(AuthorVideoQuery query);
 }
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoAccountServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoAccountServiceImpl.java
new file mode 100644
index 0000000..b7bddd1
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoAccountServiceImpl.java
@@ -0,0 +1,22 @@
+package cn.lili.modules.lmk.service.impl;
+
+import cn.lili.modules.lmk.domain.entity.VideoAccount;
+import cn.lili.modules.lmk.mapper.VideoAccountMapper;
+import cn.lili.modules.lmk.service.VideoAccountService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+ * 瑙嗛璐﹀彿淇℃伅 鏈嶅姟瀹炵幇绫�
+ *
+ * @author xp
+ * @since 2025-06-03
+ */
+@Service
+@RequiredArgsConstructor
+public class VideoAccountServiceImpl extends ServiceImpl<VideoAccountMapper, VideoAccount> implements VideoAccountService {
+
+    private final VideoAccountMapper videoAccountMapper;
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
index bf978a9..fcc57e9 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -6,6 +6,7 @@
 import cn.lili.modules.lmk.domain.entity.VideoTag;
 import cn.lili.modules.lmk.domain.entity.VideoTagRef;
 import cn.lili.modules.lmk.domain.form.*;
+import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
 import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
 import cn.lili.modules.lmk.domain.vo.*;
 import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
@@ -315,4 +316,25 @@
         footprintService.saveFootprint(footPrint);
         return Result.ok();
     }
+
+    @Override
+    public Result getAuthorInfo(String authorId) {
+        VideoAccountVO vo = baseMapper.getAuthorInfo(authorId, UserContext.getCurrentUserId());
+        vo.setSelf(authorId.equals(UserContext.getCurrentUserId()));
+        // 鏌ヨ鑾疯禐鏁�
+        List<String> videoIds = baseMapper.getVideoIdsByAuthor(authorId);
+        if (CollectionUtils.isNotEmpty(videoIds)) {
+            vo.setLikeNum(baseMapper.countAuthorVideoCollectNum(videoIds));
+        } else {
+            vo.setLikeNum(0L);
+        }
+        return Result.ok().data(vo);
+    }
+
+    @Override
+    public Result getAuthorVideoPage(AuthorVideoQuery query) {
+        IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
+        baseMapper.getAuthorVideoPage(page, query);
+        return Result.ok().data(page.getRecords()).total(page.getTotal());
+    }
 }
diff --git a/framework/src/main/resources/mapper/lmk/VideoAccountMapper.xml b/framework/src/main/resources/mapper/lmk/VideoAccountMapper.xml
new file mode 100644
index 0000000..d16f805
--- /dev/null
+++ b/framework/src/main/resources/mapper/lmk/VideoAccountMapper.xml
@@ -0,0 +1,41 @@
+<?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.VideoAccountMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.VideoAccountVO">
+        <id column="id" property="id"/>
+        <result column="user_id" property="userId" />
+        <result column="motto" property="motto" />
+    </resultMap>
+
+
+
+
+
+
+
+    <select id="getById" resultMap="BaseResultMap">
+        SELECT
+            LVA.user_id,
+            LVA.motto,
+            LVA.id
+        FROM
+            lmk_video_account LVA
+        WHERE
+            LVA.id = #{id} AND LVA.delete_flag = 0
+    </select>
+
+
+    <select id="getPage" resultMap="BaseResultMap">
+        SELECT
+            LVA.user_id,
+            LVA.motto,
+            LVA.id
+        FROM
+            lmk_video_account LVA
+        WHERE
+            LVA.delete_flag = 0
+    </select>
+
+</mapper>
diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
index be18336..7964dd8 100644
--- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -197,4 +197,59 @@
         </foreach>
     </update>
 
+
+    <select id="getAuthorInfo" resultType="cn.lili.modules.lmk.domain.vo.VideoAccountVO">
+        SELECT
+               LM.id as userId,
+               LM.nick_name as nickName,
+               LM.face as avatar,
+               LVA.motto,
+               (SELECT COUNT(*) FROM lmk_my_subscribe WHERE subscribe_user_id = #{authorId} AND delete_flag = 0) as fansNum,
+               (SELECT COUNT(*) FROM lmk_my_subscribe WHERE user_id = #{authorId} AND delete_flag = 0) as subNum,
+               (SELECT CASE
+                           WHEN id IS NOT NULL THEN 1
+                           ELSE 0
+                           END
+               FROM lmk_my_subscribe WHERE user_id = #{currentUserId} AND subscribe_user_id = #{authorId} AND delete_flag = 0) as hasSub
+        FROM
+             li_member LM
+                 LEFT JOIN lmk_video_account LVA ON LM.id = LVA.user_id
+        WHERE
+              LM.id = #{authorId} AND LM.delete_flag = 0
+    </select>
+
+    <select id="getVideoIdsByAuthor" parameterType="string" resultType="string">
+        SELECT id FROM lmk_video WHERE author_id = #{authorId} AND delete_flag = 0 AND status = '1'
+    </select>
+
+    <select id="countAuthorVideoCollectNum" resultType="long">
+        SELECT COUNT(*) FROM lmk_my_collect WHERE collect_type = 'video' AND delete_flag = 0 AND ref_id IN <foreach
+            collection="videoIds" open="(" close=")" separator="," item="videoId">#{videoId}</foreach>
+    </select>
+
+    <select id="getAuthorVideoPage" resultMap="WxResultMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.weight,
+            LV.audit_pass_time,
+            LV.update_time,
+            LV.id
+        FROM
+            lmk_video LV
+        WHERE
+            LV.delete_flag = 0 AND LV.status = '1' AND LV.author_id = #{query.authorId}
+        ORDER BY
+            LV.collect_num DESC
+    </select>
+
 </mapper>

--
Gitblit v1.8.0