admin
2022-04-25 bfb5dfa709ec55ab0cc57981b7d1504088d1bfac
src/main/java/com/yeshi/buwan/service/imp/juhe/InternetSearchVideoServiceImpl.java
@@ -8,6 +8,8 @@
import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService;
import com.yeshi.buwan.service.inter.system.SystemConfigService;
import com.yeshi.buwan.util.mq.CMQManager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -60,7 +62,7 @@
        } else {
            internetSearchVideoDao.updateSelective(video);
        }
        //全网搜入搜索引擎
        InternetSearchVideoMQMsg msg = new InternetSearchVideoMQMsg();
        msg.setId(video.getId());
        msg.setResourceId(resourceId);
@@ -106,5 +108,28 @@
        return internetSearchVideoDao.get(id);
    }
    @Cacheable(value = "internetSearch", key = "'selectByPrimaryKey-'+#id")
    @Override
    public InternetSearchVideo selectByPrimaryKeyCache(String id) {
        return selectByPrimaryKey(id);
    }
    @Override
    public List<InternetSearchVideo> listByIds(List<String> ids) {
        if (ids == null || ids.size() == 0) {
            return new ArrayList<>();
        }
        Query query = new Query();
        List<Criteria> orList = new ArrayList<>();
        for (String id : ids) {
            orList.add(Criteria.where("id").is(id));
        }
        Criteria[] ors = new Criteria[orList.size()];
        orList.toArray(ors);
        query.addCriteria(new Criteria().orOperator(ors));
        return internetSearchVideoDao.findList(query);
    }
}