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