查询逻辑修改

This commit is contained in:
张松 2025-01-03 22:21:37 +08:00
parent 5aeee2da3a
commit 2ea74b96b7
3 changed files with 3 additions and 5 deletions

View File

@ -24,5 +24,5 @@ public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
Map<String,Object> countCourse(Long courseId);
List<CourseDetails> countByCourseId(@Param("detailIdList") Set<Long> detailIdList);
List<CourseDetails> countByCourseId();
}

View File

@ -136,7 +136,7 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
.in(CourseDetails::getCourseDetailsId, detailIdList)).stream()
.collect(Collectors.toMap(CourseDetails::getCourseDetailsId, item->item));
Map<Long, Integer> countMap = detailIdList.isEmpty() ? new HashMap<>() : courseDetailsDao.countByCourseId(detailIdList).stream().collect(Collectors.toMap(CourseDetails::getCourseId, CourseDetails::getCourseDetailsCount));
Map<Long, Integer> countMap = courseDetailsDao.countByCourseId().stream().collect(Collectors.toMap(CourseDetails::getCourseId, CourseDetails::getCourseDetailsCount));
PageInfo<Course> pageInfo = new PageInfo<>(courseList);
if (CollectionUtil.isNotEmpty(courseList)) {

View File

@ -68,9 +68,7 @@
FROM
course_details
where course_details_id in
<foreach collection="detailIdList" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
GROUP BY
course_id
</select>