From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 20 二月 2025 16:57:55 +0800 Subject: [PATCH] IOS广告增加区域屏蔽 --- src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java | 287 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 284 insertions(+), 3 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..c664caf 100644 --- a/src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java +++ b/src/main/java/com/yeshi/buwan/dao/VideoInfoDao.java @@ -1,15 +1,250 @@ package com.yeshi.buwan.dao; import com.yeshi.buwan.dao.base.BaseDao; -import org.springframework.stereotype.Repository; - import com.yeshi.buwan.domain.VideoInfo; +import com.yeshi.buwan.query.BaseQuery; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.springframework.orm.hibernate4.HibernateCallback; +import org.springframework.stereotype.Repository; +import org.yeshi.utils.StringUtil; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; @Repository public class VideoInfoDao extends BaseDao<VideoInfo> { + + + /** + * 閫夋嫨鎬ф洿鏂� + * + * @param bean + */ + public void updateSelective(VideoInfo bean) { + List<String> wheres = new ArrayList<>(); + List<Serializable> params = new ArrayList<>(); + + if (bean.getTag() != null) { + wheres.add("vi.tag=?"); + params.add(bean.getTag()); + } + if (bean.getTotalNumber() != null) { + wheres.add("vi.totalNumber=?"); + params.add(bean.getTotalNumber()); + } + + if (bean.getPicture() != null) { + wheres.add("vi.picture=?"); + params.add(bean.getPicture()); + } + if (bean.getName() != null) { + wheres.add("vi.name=?"); + params.add(bean.getName()); + } + if (bean.getIntroduction() != null) { + wheres.add("vi.introduction=?"); + params.add(bean.getIntroduction()); + } + if (bean.getDuration() != null) { + wheres.add("vi.duration=?"); + params.add(bean.getDuration()); + } + if (bean.getMainActor() != null) { + wheres.add("vi.mainActor=?"); + params.add(bean.getMainActor()); + } + if (bean.getYear() != null) { + wheres.add("vi.year=?"); + params.add(bean.getYear()); + } + if (bean.getBeizhu() != null) { + wheres.add("vi.beizhu=?"); + params.add(bean.getBeizhu()); + } + if (bean.getQulity() != null) { + wheres.add("vi.qulity=?"); + params.add(bean.getQulity()); + } + if (bean.getScore() != null) { + wheres.add("vi.score=?"); + params.add(bean.getScore()); + } + if (bean.getShare() != null) { + wheres.add("vi.share=?"); + params.add(bean.getShare()); + } + if (bean.getShow() != null) { + wheres.add("vi.show=?"); + params.add(bean.getShow()); + } + if (bean.getWatchCount() != null) { + wheres.add("vi.watchCount=?"); + params.add(bean.getWatchCount()); + } + if (bean.getOrderby() != null) { + wheres.add("vi.orderby=?"); + params.add(bean.getOrderby()); + } + if (bean.getNowNumber() != null) { + wheres.add("vi.nowNumber=?"); + params.add(bean.getNowNumber()); + } + if (bean.getFinish() != null) { + wheres.add("vi.finish=?"); + params.add(bean.getFinish()); + } + if (bean.getBaseurl() != null) { + wheres.add("vi.baseurl=?"); + params.add(bean.getBaseurl()); + } + if (bean.getMonth() != null) { + wheres.add("vi.month=?"); + params.add(bean.getMonth()); + } + if (bean.getDay() != null) { + wheres.add("vi.day=?"); + params.add(bean.getDay()); + } + if (bean.getArea() != null) { + wheres.add("vi.area=?"); + params.add(bean.getArea()); + } + if (bean.getFocus() != null) { + wheres.add("vi.focus=?"); + params.add(bean.getFocus()); + } + if (bean.getLeafctgs() != null) { + wheres.add("vi.leafctgs=?"); + params.add(bean.getLeafctgs()); + } + if (bean.getDirector() != null) { + wheres.add("vi.director=?"); + params.add(bean.getDirector()); + } + if (bean.getKeyword() != null) { + wheres.add("vi.keyword=?"); + params.add(bean.getKeyword()); + } + if (bean.getVpicture() != null) { + wheres.add("vi.vpicture=?"); + params.add(bean.getVpicture()); + } + if (bean.getHpicture() != null) { + wheres.add("vi.hpicture=?"); + params.add(bean.getHpicture()); + } + if (bean.getLatestVpicture() != null) { + wheres.add("vi.latestVpicture=?"); + params.add(bean.getLatestVpicture()); + } + if (bean.getLatestHpicture() != null) { + wheres.add("vi.latestHpicture=?"); + params.add(bean.getLatestHpicture()); + } + if (bean.getContentType() != null) { + wheres.add("vi.contentType=?"); + params.add(bean.getContentType()); + } + if (bean.getCanSave() != null) { + wheres.add("vi.canSave=?"); + params.add(bean.getCanSave()); + } + if (bean.getAdmin() != null) { + wheres.add("vi.admin=?"); + params.add(bean.getAdmin()); + } + if (bean.getVideoType() != null) { + wheres.add("vi.videoType=?"); + params.add(bean.getVideoType()); + } + if (bean.getCommentCount() != null) { + wheres.add("vi.commentCount=?"); + params.add(bean.getCommentCount()); + } + if (bean.getLatestWatchCount() != null) { + wheres.add("vi.latestWatchCount=?"); + params.add(bean.getLatestWatchCount()); + } + if (bean.getVideocount() != null) { + wheres.add("vi.videocount=?"); + params.add(bean.getVideocount()); + } + + + if (bean.getType() != null) { + wheres.add("vi.type=?"); + params.add(bean.getType()); + } + + wheres.add("vi.updatetime=?"); + params.add(System.currentTimeMillis() + ""); + + String hql = "update VideoInfo vi set " + StringUtil.concat(wheres, ",") + " where vi.id=" + bean.getId(); + + Serializable[] ps = new Serializable[params.size()]; + params.toArray(ps); + update(hql, ps); + } + + + public List<VideoInfo> list(DaoQuery query) { + String hql = "from VideoInfo vi "; + List<Serializable> paramList = new ArrayList<>(); + List<String> andList = new ArrayList<>(); + if (query.show != null) { + andList.add("vi.show= ?"); + paramList.add(query.show); + } + + if (query.name != null) { + andList.add("vi.name= ?"); + paramList.add(query.name); + } + + + if (query.minId != null) { + andList.add("vi.id>=" + query.minId); + } + + if (andList.size() > 0) { + hql += "where " + StringUtil.concat(andList, " and "); + } + + Serializable[] params = new Serializable[paramList.size()]; + paramList.toArray(params); + return findList(hql, (int) query.start, query.count, params); + } + + public long count(DaoQuery query) { + String hql = "from VideoInfo vi "; + List<Serializable> paramList = new ArrayList<>(); + List<String> andList = new ArrayList<>(); + if (query.show != null) { + andList.add("vi.show= ?"); + paramList.add(query.show); + } + + if (query.name != null) { + andList.add("vi.name= ?"); + paramList.add(query.name); + } + + + if (query.minId != null) { + andList.add("vi.id>=" + query.minId); + } + + if (andList.size() > 0) { + hql += "where " + StringUtil.concat(andList, " and "); + } + + + Serializable[] params = new Serializable[paramList.size()]; + paramList.toArray(params); + return getCount(hql, params); + } /** * 鏍规嵁鍚嶅瓧鏌ヨ @@ -20,7 +255,53 @@ * @return */ public List<VideoInfo> listByName(String name, int start, int count) { - return list("from VideoInfo vi where vi.name=?", start, count, new Serializable[]{name}); + DaoQuery query = new DaoQuery(); + query.start = start; + query.count = count; + query.name = name; + return list(query); + } + + + /** + * 鏍规嵁涓婚敭鎵归噺鏌ヨ + * + * @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; + } + }); + } + + public static class DaoQuery extends BaseQuery { + public String show; + public String name; + public Long minId; } } -- Gitblit v1.8.0