| | |
| | | import com.tcm.training.admin.live.service.HealthCourseAppService; |
| | | import com.tcm.training.admin.live.vo.HealthCourseDetailVO; |
| | | import com.tcm.training.admin.live.vo.HealthCourseListItemVO; |
| | | import com.tcm.training.admin.live.vo.HealthCourseOptionVO; |
| | | import com.tcm.training.admin.live.vo.HealthCourseStatusVO; |
| | | import com.tcm.training.admin.live.vo.HealthCourseVideoDetailVO; |
| | | import com.tcm.training.admin.live.vo.HealthCourseVideoItemVO; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @Validated |
| | | @RestController |
| | |
| | | @RequestParam(required = false) Long difficultyCategoryId, |
| | | @RequestParam(required = false) Integer status) throws IOException { |
| | | healthCourseAppService.export(response, keyword, levelCategoryId, difficultyCategoryId, status); |
| | | } |
| | | |
| | | @GetMapping("/health-courses/options") |
| | | public ApiResponse<List<HealthCourseOptionVO>> options(@RequestParam(required = false) String keyword) { |
| | | return ApiResponse.ok(healthCourseAppService.options(keyword)); |
| | | } |
| | | |
| | | @PostMapping("/health-courses") |
| | |
| | | @RequestParam(required = false, defaultValue = "1") int page, |
| | | @RequestParam(required = false, defaultValue = "10") int pageSize, |
| | | @RequestParam(required = false) String chapterName, |
| | | @RequestParam(required = false) Integer saleType) { |
| | | return ApiResponse.ok(healthCourseAppService.pageVideos(courseId, page, pageSize, chapterName, saleType)); |
| | | @RequestParam(required = false) Integer priceType) { |
| | | return ApiResponse.ok(healthCourseAppService.pageVideos(courseId, page, pageSize, chapterName, priceType)); |
| | | } |
| | | |
| | | @GetMapping("/health-courses/{courseId}/videos/{videoId}") |
| | |
| | | healthCourseAppService.deleteVideo(courseId, videoId); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | |
| | | @GetMapping("/health-course-video-resources") |
| | | public ApiResponse<PageResponse<HealthCourseVideoItemVO>> pageVideoResources(@RequestParam(required = false, defaultValue = "1") int page, |
| | | @RequestParam(required = false, defaultValue = "10") int pageSize, |
| | | @RequestParam(required = false) String courseKeyword, |
| | | @RequestParam(required = false) Long courseId, |
| | | @RequestParam(required = false) Integer courseType, |
| | | @RequestParam(required = false) String chapterName, |
| | | @RequestParam(required = false) Integer priceType, |
| | | @RequestParam(required = false) Integer status) { |
| | | return ApiResponse.ok(healthCourseAppService.pageVideoResources(page, pageSize, courseKeyword, courseId, courseType, chapterName, priceType, status)); |
| | | } |
| | | |
| | | @GetMapping("/health-course-video-resources/import-template") |
| | | public void downloadVideoResourceTemplate(HttpServletResponse response) throws IOException { |
| | | healthCourseAppService.downloadVideoResourceTemplate(response); |
| | | } |
| | | |
| | | @GetMapping("/health-course-video-resources/{id}") |
| | | public ApiResponse<HealthCourseVideoDetailVO> detailVideoResource(@PathVariable("id") Long id) { |
| | | return ApiResponse.ok(healthCourseAppService.detailVideoResource(id)); |
| | | } |
| | | |
| | | @PostMapping("/health-course-video-resources") |
| | | public ApiResponse<HealthCourseVideoDetailVO> createVideoResource(@Valid @RequestBody HealthCourseVideoSaveRequest req) { |
| | | return ApiResponse.ok(healthCourseAppService.createVideoResource(req)); |
| | | } |
| | | |
| | | @PutMapping("/health-course-video-resources/{id}") |
| | | public ApiResponse<HealthCourseVideoDetailVO> updateVideoResource(@PathVariable("id") Long id, |
| | | @Valid @RequestBody HealthCourseVideoSaveRequest req) { |
| | | return ApiResponse.ok(healthCourseAppService.updateVideoResource(id, req)); |
| | | } |
| | | |
| | | @DeleteMapping("/health-course-video-resources/{id}") |
| | | public ApiResponse<Void> deleteVideoResource(@PathVariable("id") Long id) { |
| | | healthCourseAppService.deleteVideoResource(id); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | |
| | | @PostMapping("/health-course-video-resources/import") |
| | | public ApiResponse<Void> importVideoResources(@RequestParam("file") MultipartFile file) throws IOException { |
| | | healthCourseAppService.importVideoResources(file); |
| | | return ApiResponse.ok(null); |
| | | } |
| | | } |