|
|
|
@ -158,21 +158,25 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
|
// throw new BusinessException(ErrorCode.USERNAME_NOT_EXIT);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
UmsUser umsAdmin = umsUserMapper.selectOne(new LambdaQueryWrapper<UmsUser>() |
|
|
|
|
.eq(UmsUser::getUsername, username)); |
|
|
|
|
UmsAdminRoleRelation umsAdminRoleRelation = umsAdminRoleRelationMapper.selectOne(new LambdaQueryWrapper<UmsAdminRoleRelation>() |
|
|
|
|
.eq(UmsAdminRoleRelation::getAdminId, umsAdmin.getId())); |
|
|
|
|
// UmsUser umsUser = umsUserMapper.selectOne(new LambdaQueryWrapper<UmsUser>()
|
|
|
|
|
// .eq(UmsUser::getUsername, username));
|
|
|
|
|
// UmsAdminRoleRelation umsAdminRoleRelation = umsAdminRoleRelationMapper.selectOne(new LambdaQueryWrapper<UmsAdminRoleRelation>()
|
|
|
|
|
// .eq(UmsAdminRoleRelation::getAdminId, umsUser.getId()));
|
|
|
|
|
|
|
|
|
|
int roleId = Math.toIntExact(umsAdminRoleRelation.getRoleId()); |
|
|
|
|
// int roleId = Math.toIntExact(umsAdminRoleRelation.getRoleId());
|
|
|
|
|
int roleId = Math.toIntExact(courseQuery.getRoleId()); |
|
|
|
|
PageDTO<CoursesVO> coursesVOPageDTO; |
|
|
|
|
|
|
|
|
|
switch (roleId) { |
|
|
|
|
//教师--也是管理员--但是只能看自己的课程,有搜索功能
|
|
|
|
|
case 1: |
|
|
|
|
coursesVOPageDTO = queryForTeacher(courseQuery, username); |
|
|
|
|
break; |
|
|
|
|
//学生
|
|
|
|
|
case 2: |
|
|
|
|
coursesVOPageDTO = queryForStudent(courseQuery, username); |
|
|
|
|
break; |
|
|
|
|
//这个对应的是以后的院系管理员 这个才能看别的教师的课程
|
|
|
|
|
case 3: |
|
|
|
|
coursesVOPageDTO = queryForAdmin(courseQuery); |
|
|
|
|
break; |
|
|
|
@ -233,7 +237,7 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
|
// System.out.println(umsAdminTea);
|
|
|
|
|
UmsTeacher umsTeacher = umsTeacherMapper.selectOne(new LambdaQueryWrapper<UmsTeacher>() |
|
|
|
|
.eq(UmsTeacher::getUserId, umsUserTea.getId())); |
|
|
|
|
System.out.println(umsTeacher); |
|
|
|
|
// System.out.println(umsTeacher);
|
|
|
|
|
if (umsTeacher == null){ |
|
|
|
|
throw new BusinessException(ErrorCode.PARAMS_USER_NOTEXISTS); |
|
|
|
|
} |
|
|
|
|