| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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("作者id") |
| | | private String authorId; |
| | | |
| | | } |
| | | |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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> { |
| | | |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | * @param numList |
| | | */ |
| | | void updateCommentNumBatch(@Param("list") List<CollectTypeNumVO> numList); |
| | | |
| | | /** |
| | | * 视频主页作者信息 |
| | | * |
| | | * @param authorId |
| | | * @return |
| | | */ |
| | | VideoAccountVO getAuthorInfo(@Param("authorId") String authorId, @Param("currentUserId") String currentUserId); |
| | | |
| | | /** |
| | | * 获取作者的所有视频id |
| | | * |
| | | * @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); |
| | | } |
New file |
| | |
| | | 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> { |
| | | |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | * @return |
| | | */ |
| | | Result saveViewRecord(VideoFootPrintForm form); |
| | | |
| | | /** |
| | | * 获取视频主页作者信息 |
| | | * |
| | | * @param authorId |
| | | * @return |
| | | */ |
| | | Result getAuthorInfo(String authorId); |
| | | |
| | | /** |
| | | * 获取视频主页作者视频分页 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Result getAuthorVideoPage(AuthorVideoQuery query); |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | } |
New file |
| | |
| | | <?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> |
| | |
| | | </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> |