|
@@ -359,12 +359,20 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
MapUtil.populateMap(params, queryInfo);
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
- List dataList = null;
|
|
|
|
|
|
+ List<CourseScheduleDto> dataList = null;
|
|
int count = courseScheduleDao.countCourseSchedulesWithDate(params);
|
|
int count = courseScheduleDao.countCourseSchedulesWithDate(params);
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
pageInfo.setTotal(count);
|
|
pageInfo.setTotal(count);
|
|
params.put("offset", pageInfo.getOffset());
|
|
params.put("offset", pageInfo.getOffset());
|
|
dataList = courseScheduleDao.getCourseSchedulesWithDate(params);
|
|
dataList = courseScheduleDao.getCourseSchedulesWithDate(params);
|
|
|
|
+ List<Long> allCourseScheduleIds = dataList.stream().map(CourseScheduleDto::getId).collect(Collectors.toList());
|
|
|
|
+ List<Map<Integer, Integer>> courseStudentNumMaps = courseScheduleStudentPaymentDao.countCourseStudentNum(allCourseScheduleIds);
|
|
|
|
+ Map<Long, Long> courseStudentNumMap = MapUtil.convertIntegerMap(courseStudentNumMaps);
|
|
|
|
+
|
|
|
|
+ for (int i=0;i<dataList.size();i++) {
|
|
|
|
+ Long studentNum=courseStudentNumMap.get(dataList.get(i).getId());
|
|
|
|
+ dataList.get(i).setTotalStudentNum(Objects.isNull(studentNum)?0:studentNum.intValue());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
dataList = new ArrayList<>();
|
|
dataList = new ArrayList<>();
|