diff --git a/src/main/java/com/teaching/backend/controller/courses/CoursesController.java b/src/main/java/com/teaching/backend/controller/courses/CoursesController.java index 243ead4..28fa366 100644 --- a/src/main/java/com/teaching/backend/controller/courses/CoursesController.java +++ b/src/main/java/com/teaching/backend/controller/courses/CoursesController.java @@ -68,6 +68,7 @@ public class CoursesController { @ApiOperation("查询课程列表") @ValidateParams({"username"}) @GetMapping("/page") +// @PostMapping("/page") public BaseResponse> getCourses(CourseQuery courseQuery){ PageDTO coursesList = coursesService.queryCourses(courseQuery); return ResultUtils.success(coursesList); diff --git a/src/main/java/com/teaching/backend/model/vo/courses/CoursesVO.java b/src/main/java/com/teaching/backend/model/vo/courses/CoursesVO.java index a2890b5..a682fad 100644 --- a/src/main/java/com/teaching/backend/model/vo/courses/CoursesVO.java +++ b/src/main/java/com/teaching/backend/model/vo/courses/CoursesVO.java @@ -16,7 +16,7 @@ public class CoursesVO { @ApiModelProperty("id") private String id; /** - * 教师id + * 教师 */ @ApiModelProperty("教师") private String teacher; diff --git a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java index 1efe8c2..7c383bf 100644 --- a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java @@ -151,6 +151,9 @@ public class CoursesServiceImpl extends ServiceImpl impl int roleId = Integer.parseInt(umsUserMapper.selectOne(new LambdaQueryWrapper() .eq(UmsUser::getUsername, username)).getRoleId()); +// System.out.println(courseQuery.getRoleId()); +// int roleId = Integer.parseInt(courseQuery.getRoleId().get(0)); +// System.out.println(roleId); // int roleId = Math.toIntExact(umsAdminRoleRelation.getRoleId()); // int roleId = 0; @@ -168,7 +171,6 @@ public class CoursesServiceImpl extends ServiceImpl impl // roleId = Integer.parseInt((String) firstElement); // } // } - System.out.println(roleId); PageDTO coursesVOPageDTO; switch (roleId) { @@ -201,7 +203,7 @@ public class CoursesServiceImpl extends ServiceImpl impl .eq(courseQuery.getNature() != null && !courseQuery.getNature().isEmpty(), Courses::getNature, courseQuery.getNature()) .eq(courseQuery.getAssessmenttype() != null &&!courseQuery.getAssessmenttype().isEmpty(), Courses::getAssessmenttype, courseQuery.getAssessmenttype()) .page(page); - return PageDTO.of(p, CoursesVO.class); + return PageDTO.of(p,CoursesVO.class); } private PageDTO queryForStudent(CourseQuery courseQuery, String username) { @@ -398,13 +400,15 @@ public class CoursesServiceImpl extends ServiceImpl impl * 修改课程信息 * @param coursesDTO */ + @Override + @Transactional public void updateCourse(CoursesDTO coursesDTO) { String courseId = coursesDTO.getId(); Courses course = coursesMapper.selectById(courseId); - if (course.getStatus()==CourseCode.COURSE_UODATING.getValue()){ + if (course.getStatus()==CourseCode.COURSE_UPDATING.getValue()){ throw new BusinessException(ErrorCode.SYSTEM_ERROR,"课程正在修改中,请等待修改完成后再进行操作"); } - course.setStatus(CourseCode.COURSE_UODATING.getValue()); + course.setStatus(CourseCode.COURSE_UPDATING.getValue()); coursesMapper.updateById(course); BeanUtil.copyProperties(coursesDTO, course); course.setStatus(0); diff --git a/src/main/java/com/teaching/backend/utils/CourseCode.java b/src/main/java/com/teaching/backend/utils/CourseCode.java index ebac46b..5d52ae7 100644 --- a/src/main/java/com/teaching/backend/utils/CourseCode.java +++ b/src/main/java/com/teaching/backend/utils/CourseCode.java @@ -13,7 +13,7 @@ public enum CourseCode { Total_EXIT(0, "课程总目标"), - COURSE_UODATING(1, "课程正在修改中"); + COURSE_UPDATING(1, "课程正在修改中"); /**