代码修正

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. 12
      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("查询课程列表")
@ValidateParams({"username"})
@GetMapping("/page")
// @PostMapping("/page")
public BaseResponse<PageDTO<CoursesVO>> getCourses(CourseQuery courseQuery){
PageDTO<CoursesVO> coursesList = coursesService.queryCourses(courseQuery);
return ResultUtils.success(coursesList);

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

@ -151,6 +151,9 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
int roleId = Integer.parseInt(umsUserMapper.selectOne(new LambdaQueryWrapper<UmsUser>()
.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<CoursesMapper, Courses> impl
// roleId = Integer.parseInt((String) firstElement);
// }
// }
System.out.println(roleId);
PageDTO<CoursesVO> coursesVOPageDTO;
switch (roleId) {
@ -201,7 +203,7 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> 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<CoursesVO> queryForStudent(CourseQuery courseQuery, String username) {
@ -398,13 +400,15 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> 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);

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

Loading…
Cancel
Save