Sfoglia il codice sorgente

PlayRecordMapper.xml 中不再使用 ended 字段

reghao 7 mesi fa
parent
commit
708492a2e2

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/impl/VideoPlayServiceImpl.java

@@ -126,7 +126,7 @@ public class VideoPlayServiceImpl implements VideoPlayService {
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public void saveRecord(MediaProgress mediaProgress) {
+    public synchronized void saveRecord(MediaProgress mediaProgress) {
         long userId = mediaProgress.getUserId();
         String videoId = mediaProgress.getMediaId();
         double currentTime = mediaProgress.getCurrentTime();

+ 7 - 9
content/content-service/src/main/resources/mapper/vod/PlayRecordMapper.xml

@@ -4,14 +4,14 @@
 <mapper namespace="cn.reghao.tnb.content.app.vod.db.mapper.PlayRecordMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
         insert into vod_play_record
-        (`id`,`deleted`,`create_time`,`update_time`,`user_id`,`video_id`,`current_time`,`create_at`,`ended`)
+        (`id`,`deleted`,`create_time`,`update_time`,`user_id`,`video_id`,`current_time`,`create_at`)
         values 
-        (#{id},#{deleted},#{createTime},#{updateTime},#{userId},#{videoId},#{currentTime},#{createAt},#{ended})
+        (#{id},#{deleted},#{createTime},#{updateTime},#{userId},#{videoId},#{currentTime},#{createAt})
     </insert>
 
     <update id="update">
         update vod_play_record
-        set update_time=now(),`current_time`=#{currentTime},create_at=#{createAt},ended=#{ended}
+        set update_time=now(),`current_time`=#{currentTime},create_at=#{createAt}
         where id=#{id}
     </update>
 
@@ -23,12 +23,12 @@
     <select id="findAll" resultType="cn.reghao.tnb.content.app.vod.model.po.PlayRecord">
         select *
         from vod_play_record
-        where ended is true
+        limit 1000
     </select>
     <select id="findCurrentTime" resultType="java.lang.Double">
         select max(`current_time`)
         from vod_play_record
-        where `ended`=0 and user_id=#{userId} and video_id=#{videoId}
+        where user_id=#{userId} and video_id=#{videoId}
     </select>
     <select id="findMaxId" resultType="java.lang.Long">
         select max(create_at)
@@ -48,15 +48,13 @@
         from vod_play_record record
         inner join vod_video_post post
         on record.video_id=post.video_id and record.user_id=#{userId}
-        where record.ended is false and record.create_at &lt; #{nextId}
+        where record.create_at &lt; #{nextId}
         order by `create_at` desc
         limit #{pageSize}
     </select>
     <select id="findByUserIdAndVideoId" resultType="cn.reghao.tnb.content.app.vod.model.po.PlayRecord">
         select *
         from vod_play_record
-        where ended is false and user_id=#{userId} and video_id=#{videoId}
-        order by id desc
-        limit 1
+        where user_id=#{userId} and video_id=#{videoId}
     </select>
 </mapper>