代码修正

master
Alan 4 months ago
parent ab59e0069f
commit 79a8fd2444
  1. 1
      src/main/java/com/teaching/backend/controller/courses/CoursesController.java
  2. 2
      src/main/java/com/teaching/backend/model/vo/courses/CoursesVO.java
  3. 10
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  4. 2
      src/main/java/com/teaching/backend/utils/CourseCode.java

@ -68,6 +68,7 @@ public class CoursesController {
@ApiOperation("查询课程列表") @ApiOperation("查询课程列表")
@ValidateParams({"username"}) @ValidateParams({"username"})
@GetMapping("/page") @GetMapping("/page")
// @PostMapping("/page")
public BaseResponse<PageDTO<CoursesVO>> getCourses(CourseQuery courseQuery){ public BaseResponse<PageDTO<CoursesVO>> getCourses(CourseQuery courseQuery){
PageDTO<CoursesVO> coursesList = coursesService.queryCourses(courseQuery); PageDTO<CoursesVO> coursesList = coursesService.queryCourses(courseQuery);
return ResultUtils.success(coursesList); return ResultUtils.success(coursesList);

@ -16,7 +16,7 @@ public class CoursesVO {
@ApiModelProperty("id") @ApiModelProperty("id")
private String id; private String id;
/** /**
* 教师id * 教师
*/ */
@ApiModelProperty("教师") @ApiModelProperty("教师")
private String teacher; private String teacher;

@ -151,6 +151,9 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
int roleId = Integer.parseInt(umsUserMapper.selectOne(new LambdaQueryWrapper<UmsUser>() int roleId = Integer.parseInt(umsUserMapper.selectOne(new LambdaQueryWrapper<UmsUser>()
.eq(UmsUser::getUsername, username)).getRoleId()); .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 = Math.toIntExact(umsAdminRoleRelation.getRoleId());
// int roleId = 0; // int roleId = 0;
@ -168,7 +171,6 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
// roleId = Integer.parseInt((String) firstElement); // roleId = Integer.parseInt((String) firstElement);
// } // }
// } // }
System.out.println(roleId);
PageDTO<CoursesVO> coursesVOPageDTO; PageDTO<CoursesVO> coursesVOPageDTO;
switch (roleId) { switch (roleId) {
@ -398,13 +400,15 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
* 修改课程信息 * 修改课程信息
* @param coursesDTO * @param coursesDTO
*/ */
@Override
@Transactional
public void updateCourse(CoursesDTO coursesDTO) { public void updateCourse(CoursesDTO coursesDTO) {
String courseId = coursesDTO.getId(); String courseId = coursesDTO.getId();
Courses course = coursesMapper.selectById(courseId); 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,"课程正在修改中,请等待修改完成后再进行操作"); throw new BusinessException(ErrorCode.SYSTEM_ERROR,"课程正在修改中,请等待修改完成后再进行操作");
} }
course.setStatus(CourseCode.COURSE_UODATING.getValue()); course.setStatus(CourseCode.COURSE_UPDATING.getValue());
coursesMapper.updateById(course); coursesMapper.updateById(course);
BeanUtil.copyProperties(coursesDTO, course); BeanUtil.copyProperties(coursesDTO, course);
course.setStatus(0); course.setStatus(0);

@ -13,7 +13,7 @@ public enum CourseCode {
Total_EXIT(0, "课程总目标"), Total_EXIT(0, "课程总目标"),
COURSE_UODATING(1, "课程正在修改中"); COURSE_UPDATING(1, "课程正在修改中");
/** /**

Loading…
Cancel
Save