| | |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.security.annotation.InnerAuth; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.course.api.domain.CourseCategory; |
| | | import com.xinquan.course.api.domain.CourseChapter; |
| | | import com.xinquan.course.service.CourseCategoryService; |
| | | import com.xinquan.course.service.CourseChapterService; |
| | | import com.xinquan.course.service.CourseService; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class InnerCourseController { |
| | | |
| | | private final CourseService courseService; |
| | | @Resource |
| | | private CourseCategoryService courseCategoryService; |
| | | @Resource |
| | | private CourseChapterService courseChapterService; |
| | | |
| | | /** |
| | | * 根据课程id获取课程信息 |
| | | * |
| | | * @return 课程信息 |
| | | */ |
| | | @InnerAuth |
| | | @GetMapping("/getCourseById/{targetId}") |
| | | public R<Course> getCourseById(@PathVariable("targetId") Long targetId) { |
| | | return R.ok(courseService.getById(targetId)); |
| | | Course byId = courseService.getById(targetId); |
| | | CourseCategory byId1 = courseCategoryService.getById(byId.getCateId()); |
| | | byId.setCategoryName(byId1.getName()); |
| | | int size = courseChapterService.lambdaQuery().eq(CourseChapter::getCourseId, targetId) |
| | | .list().size(); |
| | | byId.setCourseChapterCount(Long.valueOf(size)); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |