src/main/java/cc/mrbird/febs/video/mapper/VideoHistoryMapper.java
@@ -9,4 +9,6 @@ public interface VideoHistoryMapper extends BaseMapper<VideoHistoryEntity> { int delVideoHistoryByIdsAndMemberId(@Param("list")List<String> idList, @Param("memberId")Long id); VideoHistoryEntity selectByMemberIdAndVideoId(@Param("memberId") Long memberId, @Param("videoId") Long videoId); } src/main/java/cc/mrbird/febs/video/service/impl/VideoMasterInfoServiceImpl.java
@@ -223,11 +223,17 @@ videoInfoVo.setTimeLength(currentItem.getTimeLength()); if (loginUser != null) { VideoHistoryEntity history = new VideoHistoryEntity(); history.setVideoId(videoInfoEntity.getId()); history.setMemberId(loginUser.getId()); history.setVideoItemId(currentItem.getId()); this.videoHistoryMapper.insert(history); VideoHistoryEntity history = this.videoHistoryMapper.selectByMemberIdAndVideoId(loginUser.getId(), videoInfoEntity.getId()); if (history == null) { history = new VideoHistoryEntity(); history.setVideoId(videoInfoEntity.getId()); history.setMemberId(loginUser.getId()); history.setVideoItemId(currentItem.getId()); this.videoHistoryMapper.insert(history); } else { history.setVideoItemId(currentItem.getId()); this.videoHistoryMapper.updateById(history); } } return videoInfoVo; src/main/resources/mapper/modules/VideoHistoryMapper.xml
@@ -13,4 +13,7 @@ </delete> <select id="selectByMemberIdAndVideoId" resultType="cc.mrbird.febs.video.entity.VideoHistoryEntity"> select * from video_history where member_id=#{memberId} and video_id=#{videoId} </select> </mapper>