Преглед изворни кода

增加判断数据是否存在

xueyiming пре 1 месец
родитељ
комит
a072241100

+ 9 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/MatchVideoServiceImpl.java

@@ -230,6 +230,15 @@ public class MatchVideoServiceImpl {
     }
 
     public void addCrawlerVideo(MatchVideo matchVideo) {
+
+        //判断数据是否已经存在
+        CrawlerVideoExample crawlerVideoExample = new CrawlerVideoExample();
+        crawlerVideoExample.createCriteria().andContentIdEqualTo(matchVideo.getContentId());
+        long l = crawlerVideoMapper.countByExample(crawlerVideoExample);
+        if (l > 0) {
+            return;
+        }
+
         //数据准备
         SingleVideoSourceExample example = new SingleVideoSourceExample();
         example.createCriteria().andContentTraceIdEqualTo(matchVideo.getVideoPoolTraceId());
@@ -246,7 +255,6 @@ public class MatchVideoServiceImpl {
         SingleVideoSource singleVideoSource = singleVideoSources.get(0);
         VideoContentUnderstanding videoContentUnderstanding = videoContentUnderstandings.get(0);
 
-
         //视频抓取表插入
         CrawlerVideo crawlerVideo = new CrawlerVideo();
         crawlerVideo.setDownloadStatus(2);