| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.dao.ResourceVideoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; |
| | | import com.yeshi.buwan.dto.mq.VideoExtraInfoChangeMQMsg; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Query; |
| | | import org.hibernate.Session; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | |
| | | cv.setVideoType(new VideoType(categoryId)); |
| | | categoryVideoDao.save(cv); |
| | | CMQManager.getInstance().addVideoExtraInfoChanged(new VideoExtraInfoChangeMQMsg(VideoExtraInfoChangeMQMsg.TYPE_CATEGORY, videoId, VideoExtraInfoChangeMQMsg.ACTION_ADD)); |
| | | CMQManager.getInstance().addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_CATEGORY, videoId, VideoDataChangeMQMsg.ACTION_ADD)); |
| | | } |
| | | } |
| | | |
| | | public List<CategoryVideo> getCategoryList(List<VideoInfo> videoInfoList) { |
| | | String hql = "from CategoryVideo cv where "; |
| | | List<String> orList=new ArrayList<>(); |
| | | List<String> orList = new ArrayList<>(); |
| | | for (VideoInfo videoInfo : videoInfoList) { |
| | | orList.add( "cv.video.id=" + videoInfo.getId() ); |
| | | orList.add("cv.video.id=" + videoInfo.getId()); |
| | | } |
| | | hql+= StringUtil.concat(orList," or "); |
| | | hql += StringUtil.concat(orList, " or "); |
| | | return categoryVideoDao.list(hql); |
| | | } |
| | | |
| | | public List<CategoryVideo> getCategoryList(String videoId) { |
| | | String hql = "from CategoryVideo cv where cv.video.id=" + videoId; |
| | | return categoryVideoDao.list(hql); |
| | | } |
| | | |
| | | |
| | | } |