作业+文档章节接口
This commit is contained in:
parent
4c160a7bb3
commit
3d9fda6230
@ -23,6 +23,7 @@ import org.jeecg.modules.biz.service.CourseBizService;
|
|||||||
import org.jeecg.modules.gen.course.entity.Course;
|
import org.jeecg.modules.gen.course.entity.Course;
|
||||||
import org.jeecg.modules.gen.coursecategory.entity.CourseCategory;
|
import org.jeecg.modules.gen.coursecategory.entity.CourseCategory;
|
||||||
import org.jeecg.modules.gen.coursesection.entity.CourseSection;
|
import org.jeecg.modules.gen.coursesection.entity.CourseSection;
|
||||||
|
import org.jeecg.modules.gen.homework.entity.Homework;
|
||||||
import org.jeecg.modules.gen.resource.entity.Resource;
|
import org.jeecg.modules.gen.resource.entity.Resource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -106,12 +107,30 @@ public class CourseBizController {
|
|||||||
@GetMapping("/{courseId}/section_video/{sectionId}")
|
@GetMapping("/{courseId}/section_video/{sectionId}")
|
||||||
@Operation(summary = "查询视频章节详情", description = "该接口需要携带用户登录token。根据章节id查询章节详情,不同类型的章节,返回的内容不同")
|
@Operation(summary = "查询视频章节详情", description = "该接口需要携带用户登录token。根据章节id查询章节详情,不同类型的章节,返回的内容不同")
|
||||||
public Result<List<Resource>> querySectionDetail(@PathVariable(value = "courseId") String courseId, @PathVariable(value = "sectionId") String sectionId) {
|
public Result<List<Resource>> querySectionDetail(@PathVariable(value = "courseId") String courseId, @PathVariable(value = "sectionId") String sectionId) {
|
||||||
// TODO 获取用户id,根据courseId判断当前用户是否报名课程,只有已报名的课程才能查看章节详情
|
// TODO GC 获取用户id,根据courseId判断当前用户是否报名课程,只有已报名的课程才能查看章节详情
|
||||||
|
|
||||||
List<Resource> list = courseBizService.getCourseSectionDetail(0, sectionId, Resource.class);
|
List<Resource> list = courseBizService.getCourseSectionDetail(0, sectionId, Resource.class);
|
||||||
return Result.OK(list);
|
return Result.OK(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{courseId}/section_document/{sectionId}")
|
||||||
|
@Operation(summary = "查询文档章节详情", description = "该接口需要携带用户登录token。根据章节id查询章节详情,不同类型的章节,返回的内容不同")
|
||||||
|
public Result<List<Resource>> querySectionDocumentDetail(@PathVariable(value = "courseId") String courseId, @PathVariable(value = "sectionId") String sectionId) {
|
||||||
|
// TODO GC 获取用户id,根据courseId判断当前用户是否报名课程,只有已报名的课程才能查看章节详情
|
||||||
|
|
||||||
|
List<Resource> list = courseBizService.getCourseSectionDetail(1, sectionId, Resource.class);
|
||||||
|
return Result.OK(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{courseId}/section_homework/{sectionId}")
|
||||||
|
@Operation(summary = "查询作业章节详情", description = "该接口需要携带用户登录token。根据章节id查询章节详情,不同类型的章节,返回的内容不同")
|
||||||
|
public Result<List<Homework>> querySectionHomeworkDetail(@PathVariable(value = "courseId") String courseId, @PathVariable(value = "sectionId") String sectionId) {
|
||||||
|
// TODO GC 获取用户id,根据courseId判断当前用户是否报名课程,只有已报名的课程才能查看章节详情
|
||||||
|
|
||||||
|
List<Homework> list = courseBizService.getCourseSectionDetail(3, sectionId, Homework.class);
|
||||||
|
return Result.OK(list);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/{courseId}/teachers")
|
@GetMapping("/{courseId}/teachers")
|
||||||
@Operation(summary = "查询课程的授课教师")
|
@Operation(summary = "查询课程的授课教师")
|
||||||
@IgnoreAuth
|
@IgnoreAuth
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package org.jeecg.modules.biz.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jeecg.modules.biz.service.IHomeworkBizService;
|
||||||
|
import org.jeecg.modules.gen.homework.entity.Homework;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/biz/homework")
|
||||||
|
@Tag(name = "作业")
|
||||||
|
@Slf4j
|
||||||
|
public class HomeworkBizController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IHomeworkBizService homeworkBizService;
|
||||||
|
|
||||||
|
@GetMapping("/course/{courseId}")
|
||||||
|
@Operation(summary = "查询课程作业")
|
||||||
|
public Result<List<Homework>> list(@PathVariable String courseId) {
|
||||||
|
return Result.OK(homeworkBizService.listByCourseId(courseId));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package org.jeecg.modules.biz.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jeecg.modules.gen.homework.entity.Homework;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface IHomeworkBizService extends IService<Homework> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询某课程章节下的作业
|
||||||
|
* @param courseId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Homework> listByCourseId(String courseId);
|
||||||
|
|
||||||
|
}
|
@ -18,6 +18,7 @@ import org.jeecg.modules.gen.coursesection.entity.CourseSection;
|
|||||||
import org.jeecg.modules.gen.coursesection.mapper.CourseSectionMapper;
|
import org.jeecg.modules.gen.coursesection.mapper.CourseSectionMapper;
|
||||||
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
||||||
import org.jeecg.modules.gen.courseteacher.mapper.CourseTeacherMapper;
|
import org.jeecg.modules.gen.courseteacher.mapper.CourseTeacherMapper;
|
||||||
|
import org.jeecg.modules.gen.homework.mapper.HomeworkMapper;
|
||||||
import org.jeecg.modules.gen.resource.mapper.ResourceMapper;
|
import org.jeecg.modules.gen.resource.mapper.ResourceMapper;
|
||||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||||
import org.jeecg.modules.gen.userinfo.mapper.UserInfoMapper;
|
import org.jeecg.modules.gen.userinfo.mapper.UserInfoMapper;
|
||||||
@ -69,6 +70,9 @@ public class CourseBizServiceImpl extends ServiceImpl<CourseMapper, Course> impl
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HomeworkMapper homeworkMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> List<T> getCourseSectionDetail(Integer type, String sectionId, Class<T> clazz) {
|
public <T> List<T> getCourseSectionDetail(Integer type, String sectionId, Class<T> clazz) {
|
||||||
// 1. 查询章节是否存在
|
// 1. 查询章节是否存在
|
||||||
@ -108,6 +112,7 @@ public class CourseBizServiceImpl extends ServiceImpl<CourseMapper, Course> impl
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> targetIds = entityLinkBizService.listTargetIds(sourceType, sourceId, targetType);
|
List<String> targetIds = entityLinkBizService.listTargetIds(sourceType, sourceId, targetType);
|
||||||
if (targetIds.isEmpty()) {
|
if (targetIds.isEmpty()) {
|
||||||
throw new RuntimeException("章节没有关联的实体");
|
throw new RuntimeException("章节没有关联的实体");
|
||||||
@ -129,7 +134,8 @@ public class CourseBizServiceImpl extends ServiceImpl<CourseMapper, Course> impl
|
|||||||
// TODO 考试章节
|
// TODO 考试章节
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// TODO 作业章节
|
// 作业章节
|
||||||
|
result.add(clazz.cast(homeworkMapper.selectById(targetId)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.jeecg.modules.biz.service.impl;
|
||||||
|
|
||||||
|
import org.jeecg.modules.biz.constant.EntityLinkConst;
|
||||||
|
import org.jeecg.modules.biz.service.EntityLinkBizService;
|
||||||
|
import org.jeecg.modules.biz.service.IHomeworkBizService;
|
||||||
|
import org.jeecg.modules.gen.homework.entity.Homework;
|
||||||
|
import org.jeecg.modules.gen.homework.mapper.HomeworkMapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class HomeworkBizServiceImpl extends ServiceImpl<HomeworkMapper, Homework> implements IHomeworkBizService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntityLinkBizService entityLinkBizService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Homework> listByCourseId(String courseId) {
|
||||||
|
List<String> homeworkIds = entityLinkBizService.listTargetIds(EntityLinkConst.SourceType.COURSE, courseId, EntityLinkConst.TargetType.HOMEWORK);
|
||||||
|
return this.listByIds(homeworkIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user