| | |
| | | |
| | | List<BenefitsVideoClassificationListVo> listVos = new ArrayList<>(); |
| | | for (BenefitsVideoClassification benefitsVideoClassification : list) { |
| | | BenefitsVideoClassificationListVo benefitsVideoClassificationListVo = new BenefitsVideoClassificationListVo(); |
| | | benefitsVideoClassificationListVo.setId(benefitsVideoClassification.getId()); |
| | | benefitsVideoClassificationListVo.setName(benefitsVideoClassification.getName()); |
| | | QueryWrapper<BenefitsVideos> benefitsVideosQueryWrapper = new QueryWrapper<BenefitsVideos>().eq("state", 1).eq("benefitsVideoClassificationId",benefitsVideoClassification.getId()); |
| | | if(collect.size() > 0){ |
| | | benefitsVideosQueryWrapper.notIn("id", collect); |
| | | if (benefitsVideoClassification.getState() == 1) { |
| | | BenefitsVideoClassificationListVo benefitsVideoClassificationListVo = new BenefitsVideoClassificationListVo(); |
| | | benefitsVideoClassificationListVo.setId(benefitsVideoClassification.getId()); |
| | | benefitsVideoClassificationListVo.setName(benefitsVideoClassification.getName()); |
| | | QueryWrapper<BenefitsVideos> benefitsVideosQueryWrapper = new QueryWrapper<BenefitsVideos>().eq("state", 1).eq("benefitsVideoClassificationId", benefitsVideoClassification.getId()); |
| | | if (collect.size() > 0) { |
| | | benefitsVideosQueryWrapper.notIn("id", collect); |
| | | } |
| | | List<BenefitsVideos> list1 = this.list(benefitsVideosQueryWrapper.orderByDesc("insertTime").last(" limit 0, 4")); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (BenefitsVideos benefitsVideos : list1) { |
| | | if (benefitsVideos.getState()==1) { |
| | | Integer courseId = benefitsVideos.getCourseId(); |
| | | Course course = courseClient.queryCourseById(courseId); |
| | | BenefitsVideosListVo benefitsVideosListVo = new BenefitsVideosListVo(); |
| | | benefitsVideosListVo.setId(benefitsVideos.getId()); |
| | | benefitsVideosListVo.setName(course.getName()); |
| | | benefitsVideosListVo.setCover(course.getCoverDrawing()); |
| | | benefitsVideosListVo.setIntroduce(course.getIntroduce()); |
| | | lists.add(benefitsVideosListVo); |
| | | } |
| | | } |
| | | benefitsVideoClassificationListVo.setList(lists); |
| | | listVos.add(benefitsVideoClassificationListVo); |
| | | } |
| | | List<BenefitsVideos> list1 = this.list(benefitsVideosQueryWrapper.orderByDesc("insertTime").last(" limit 0, 4")); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (BenefitsVideos benefitsVideos : list1) { |
| | | Integer courseId = benefitsVideos.getCourseId(); |
| | | Course course = courseClient.queryCourseById(courseId); |
| | | BenefitsVideosListVo benefitsVideosListVo = new BenefitsVideosListVo(); |
| | | benefitsVideosListVo.setId(benefitsVideos.getId()); |
| | | benefitsVideosListVo.setName(course.getName()); |
| | | benefitsVideosListVo.setCover(course.getCoverDrawing()); |
| | | benefitsVideosListVo.setIntroduce(course.getIntroduce()); |
| | | lists.add(benefitsVideosListVo); |
| | | } |
| | | benefitsVideoClassificationListVo.setList(lists); |
| | | listVos.add(benefitsVideoClassificationListVo); |
| | | } |
| | | return listVos; |
| | | } |
| | |
| | | public List<BenefitsVideosListVo> queryBenefitsVideosList(Integer uid, Integer classificationId, String search, Integer pageSize, Integer pageNo) throws Exception { |
| | | pageSize = (pageSize - 1) * pageNo; |
| | | List<Integer> ids = null; |
| | | |
| | | if(ToolUtil.isNotEmpty(search)){ |
| | | List<Course> courses = courseClient.queryCourseByName(search); |
| | | ids = courses.stream().map(Course::getId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | List<Map<String, Object>> benefitsVideos = this.baseMapper.queryBenefitsVideosList(uid, classificationId, ids, pageSize, pageNo); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (Map<String, Object> benefitsVideo : benefitsVideos) { |