| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.context.WebContext; |
| | | import com.ycl.jxkg.domain.entity.Meet; |
| | | import com.ycl.jxkg.domain.entity.MeetClasses; |
| | | import com.ycl.jxkg.domain.entity.MeetStudent; |
| | | import com.ycl.jxkg.domain.entity.StudyRecord; |
| | | import com.ycl.jxkg.domain.entity.*; |
| | | import com.ycl.jxkg.domain.form.MeetForm; |
| | | import com.ycl.jxkg.domain.query.MeetQuery; |
| | | import com.ycl.jxkg.domain.vo.ClassesVO; |
| | |
| | | */ |
| | | @Override |
| | | public Result page(MeetQuery query) { |
| | | Integer id = webContext.getCurrentUser().getId(); |
| | | //查自己创建的房间 |
| | | query.setTeacherId(id); |
| | | Integer userId = webContext.getCurrentUser().getId(); |
| | | //查自己的会议 |
| | | List<ClassesUser> classes = new LambdaQueryChainWrapper<>(classesUserMapper) |
| | | .eq(ClassesUser::getUserId, userId) |
| | | .eq(ClassesUser::getTeacher, Boolean.TRUE) |
| | | .list(); |
| | | List<Integer> classesIds = classes.stream().map(ClassesUser::getClassesId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(classesIds) && 3 != webContext.getCurrentUser().getRole()) { |
| | | throw new RuntimeException("您暂时无法访问该页面"); |
| | | } |
| | | query.setClassesIds(classesIds); |
| | | IPage<MeetVO> page = PageUtil.getPage(query, MeetVO.class); |
| | | baseMapper.getPage(page, query); |
| | | baseMapper.teacherPage(page, query); |
| | | page.getRecords().forEach(vo -> { |
| | | if (!CollectionUtils.isEmpty(vo.getTeacherNames())) { |
| | | vo.setTeacherNamesStr(vo.getTeacherNames().stream().collect(Collectors.joining("、"))); |
| | | if (! CollectionUtils.isEmpty(vo.getClassesIds())) { |
| | | // 查主讲老师 |
| | | List<String> teacherNames = classesUserMapper.getTeachersByClassesIds(vo.getClassesIds()); |
| | | if (! CollectionUtils.isEmpty(teacherNames)) { |
| | | vo.setTeacherNamesStr(teacherNames.stream().collect(Collectors.joining("、"))); |
| | | } |
| | | } |
| | | }); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | |
| | | query.setClassesIds(classes); |
| | | } |
| | | IPage<MeetVO> page = PageUtil.getPage(query, MeetVO.class); |
| | | baseMapper.getPage(page, query); |
| | | baseMapper.studentPage(page, query); |
| | | for (MeetVO vo : page.getRecords()) { |
| | | if (!CollectionUtils.isEmpty(vo.getTeacherNames())) { |
| | | vo.setTeacherNamesStr(vo.getTeacherNames().stream().collect(Collectors.joining("、"))); |
| | | if (! CollectionUtils.isEmpty(vo.getClassesIds())) { |
| | | // 查主讲老师 |
| | | List<String> teacherNames = classesUserMapper.getTeachersByClassesIds(vo.getClassesIds()); |
| | | if (! CollectionUtils.isEmpty(teacherNames)) { |
| | | vo.setTeacherNamesStr(teacherNames.stream().collect(Collectors.joining("、"))); |
| | | } |
| | | } |
| | | } |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |