From 4011b8d0b377af33e2bc435f7726329630d706cb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 02 三月 2021 18:28:52 +0800 Subject: [PATCH] 搜索引擎接口更新 --- src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java b/src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java index 1815739..eb9c7aa 100644 --- a/src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java +++ b/src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java @@ -1,11 +1,17 @@ package com.yeshi.buwan.dao; import com.yeshi.buwan.dao.base.BaseDao; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Repository; import com.yeshi.buwan.domain.VideoInfo; +import org.yeshi.utils.StringUtil; import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; @Repository @@ -23,4 +29,40 @@ return list("from VideoInfo vi where vi.name=?", start, count, new Serializable[]{name}); } + + /** + * 鏍规嵁涓婚敭鎵归噺鏌ヨ + * + * @param videoIds + * @return + */ + public List<VideoInfo> listByVideoIds(List<String> videoIds) { + String hql = "from VideoInfo vi where "; + List<String> ors = new ArrayList<>(); + for (String vi : videoIds) { + ors.add(" vi.id=? "); + } + hql += StringUtil.concat(ors, "or"); + String[] videos = new String[videoIds.size()]; + videoIds.toArray(videos); + return list(hql, videos); + } + + /** + * 缁熻瑙嗛闄勫姞淇℃伅锛堝寘鍚湴鍖猴紝鍒嗙被锛屾潵婧愶級 + * + * @param videoId -瑙嗛ID + */ + public void statisticVideoExtraInfo(final String videoId) { + excute(new HibernateCallback() { + @Override + public Object doInHibernate(Session session) throws HibernateException { + session.getTransaction().begin(); + session.createSQLQuery(String.format("call copyvideotemp(%s)", videoId)).executeUpdate(); + session.getTransaction().commit(); + return null; + } + }); + } + } -- Gitblit v1.8.0