Ver Fonte

content-service 的 VideoPostTag 修改为 VideoTag, 数据库表名修改为 vod_video_tag

reghao há 5 meses atrás
pai
commit
fd3dcd31cb

+ 2 - 3
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/db/mapper/VideoPostTagMapper.java

@@ -2,8 +2,7 @@ package cn.reghao.tnb.content.app.vod.db.mapper;
 
 import cn.reghao.jutil.jdk.db.BaseMapper;
 import cn.reghao.jutil.jdk.db.Page;
-import cn.reghao.tnb.content.app.vod.model.po.VideoPostTag;
-import cn.reghao.tnb.common.db.GroupCount;
+import cn.reghao.tnb.content.app.vod.model.po.VideoTag;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -14,7 +13,7 @@ import java.util.List;
  * @date 2023-05-11 15:21:31
  */
 @Mapper
-public interface VideoPostTagMapper extends BaseMapper<VideoPostTag> {
+public interface VideoPostTagMapper extends BaseMapper<VideoTag> {
     void updateSetScope(@Param("videoId") String videoId, @Param("scope") int scope);
 
     int countVideosByTag(@Param("tagId") String tagId, @Param("scopes") List<Integer> scopes);

+ 1 - 1
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoPostTag.java → content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/model/po/VideoTag.java

@@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 @NoArgsConstructor
 @Getter
-public class VideoPostTag extends BaseObject<Integer> {
+public class VideoTag extends BaseObject<Integer> {
     private String videoId;
     private Integer scope;
     private String tagId;

+ 4 - 4
content/content-service/src/main/java/cn/reghao/tnb/content/app/vod/service/TagService.java

@@ -6,7 +6,7 @@ import cn.reghao.tnb.common.auth.UserContext;
 import cn.reghao.tnb.content.app.vod.db.mapper.PostTagMapper;
 import cn.reghao.tnb.content.app.vod.db.mapper.VideoPostTagMapper;
 import cn.reghao.tnb.content.app.vod.model.po.PostTag;
-import cn.reghao.tnb.content.app.vod.model.po.VideoPostTag;
+import cn.reghao.tnb.content.app.vod.model.po.VideoTag;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
@@ -40,16 +40,16 @@ public class TagService {
         }
 
         List<PostTag> list = new ArrayList<>();
-        List<VideoPostTag> list1 = new ArrayList<>();
+        List<VideoTag> list1 = new ArrayList<>();
         for (String str : tags.split(",")) {
             String tag = StringUtils.trimAllWhitespace(str);
             PostTag postTag = postTagMapper.findByName(tag);
             if (postTag != null) {
-                list1.add(new VideoPostTag(videoId, scope, postTag.getTagId()));
+                list1.add(new VideoTag(videoId, scope, postTag.getTagId()));
             } else {
                 String tagId = UUID.randomUUID().toString().replace("-", "");
                 list.add(new PostTag(tagId, tag));
-                list1.add(new VideoPostTag(videoId, scope, tagId));
+                list1.add(new VideoTag(videoId, scope, tagId));
             }
         }
 

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

@@ -3,13 +3,13 @@
 
 <mapper namespace="cn.reghao.tnb.content.app.vod.db.mapper.VideoPostTagMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        insert into vod_video_tags
+        insert into vod_video_tag
         (`video_id`,`scope`,`tag_id`)
         values
         (#{videoId},#{scope},#{tagId})
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
-        insert ignore into vod_video_tags
+        insert ignore into vod_video_tag
         (`video_id`,`scope`,`tag_id`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
@@ -18,19 +18,19 @@
     </insert>
 
     <update id="updateSetScope">
-        update vod_video_tags
+        update vod_video_tag
         set `scope`=#{scope}
         where video_id=#{videoId}
     </update>
 
-    <select id="findAll" resultType="cn.reghao.tnb.content.app.vod.model.po.VideoPostTag">
+    <select id="findAll" resultType="cn.reghao.tnb.content.app.vod.model.po.VideoTag">
         select *
-        from vod_video_tags
+        from vod_video_tag
         limit 1000
     </select>
     <select id="countVideosByTag" resultType="java.lang.Integer">
         select count(*)
-        from vod_video_tags
+        from vod_video_tag
         where tag_id=#{tagId} and scope in
         <foreach collection="scopes" item="id" index="index" open="(" close=")" separator=",">
             #{id}
@@ -38,7 +38,7 @@
     </select>
     <select id="findVideosByPage" resultType="java.lang.String">
         select video_id
-        from vod_video_tags
+        from vod_video_tag
         where tag_id=#{tagId} and scope in
         <foreach collection="scopes" item="id" index="index" open="(" close=")" separator=",">
             #{id}
@@ -46,12 +46,12 @@
     </select>
     <select id="findVideoTags" resultType="java.lang.String">
         select tag_id
-        from vod_video_tags
+        from vod_video_tag
         where video_id=#{videoId}
     </select>
     <select id="findByGroupBy" resultType="java.lang.String">
         select video_id
-        from vod_video_tags
+        from vod_video_tag
         group by video_id
     </select>
 </mapper>

+ 2 - 2
content/content-service/src/test/java/cn/reghao/tnb/content/app/vod/service/VideoPostTest.java

@@ -363,7 +363,7 @@ public class VideoPostTest {
         String filePath = "/home/reghao/Downloads/1_fyt91.txt";
         //filePath = "/home/reghao/Downloads/1_fytgc.txt";
 
-        List<VideoPostTag> list = new ArrayList<>();
+        List<VideoTag> list = new ArrayList<>();
         for (String line : textFile.read(filePath)) {
             if (line.startsWith("exist")) {
                 String videoIdsStr = line.split(" videoId ")[1];
@@ -375,7 +375,7 @@ public class VideoPostTest {
                     /*VideoPost videoPost = videoPostMapper.findByVideoId(videoId);
                     long publishBy = videoPost.getPublishBy();*/
                     sb.append("'").append(videoId).append("',");
-                    list.add(new VideoPostTag(videoId, scope, tagId));
+                    list.add(new VideoTag(videoId, scope, tagId));
                 }
             }
         }