package com.xinquan.course.controller.client;
|
|
|
import com.xinquan.common.core.constant.SecurityConstants;
|
import com.xinquan.common.core.domain.R;
|
import com.xinquan.common.core.utils.page.PageDTO;
|
import com.xinquan.course.domain.Course;
|
import com.xinquan.course.domain.vo.ClientCourseCategoryVO;
|
import com.xinquan.course.domain.vo.ClientCourseVO;
|
import com.xinquan.course.service.CourseCategoryService;
|
import com.xinquan.course.service.CourseService;
|
import com.xinquan.system.api.RemoteBannerService;
|
import com.xinquan.system.api.domain.vo.BannerVO;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import java.util.List;
|
|
import io.swagger.models.auth.In;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* <p>
|
* 线上课程表 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-08-21
|
*/
|
@Api(tags = {"用户端-课程相关接口"})
|
@RestController
|
@RequiredArgsConstructor
|
@RequestMapping("/client/course/course")
|
public class ClientCourseController {
|
|
private final CourseCategoryService courseCategoryService;
|
private final CourseService courseService;
|
private final RemoteBannerService remoteBannerService;
|
|
/**
|
* 获取轮播图列表
|
*
|
* @return 轮播图列表
|
*/
|
@GetMapping("/getBannerList")
|
@ApiOperation(value = "获取轮播图列表")
|
public R<List<BannerVO>> getBannerList() {
|
return remoteBannerService.getBannerList(SecurityConstants.INNER);
|
}
|
|
/**
|
* 获取课程分类列表
|
*
|
* @return 课程分类列表
|
*/
|
@GetMapping("/getCourseCategoryList")
|
@ApiOperation(value = "获取课程分类列表")
|
public R<List<ClientCourseCategoryVO>> getCourseCategoryList() {
|
return R.ok(courseCategoryService.getCourseCategoryList());
|
}
|
/**
|
* 课程详情
|
*
|
* @return 课程详情
|
*/
|
@GetMapping("/getCourseInfoById")
|
@ApiOperation(value = "根据id获取课程详情-线下课程")
|
public R<Course> getCourseInfoById(String id) {
|
return R.ok(courseService.getById(id));
|
}
|
/**
|
* 课程详情
|
*
|
* @return 课程详情
|
*/
|
@GetMapping("/getPayCourseInfoById")
|
@ApiOperation(value = "根据id获取课程详情-付费课程")
|
public R<Course> getPayCourseInfoById(String id) {
|
|
return R.ok(courseService.getById(id));
|
}
|
|
/**
|
* 获取课程列表-分页
|
*
|
* @param courseTitle 课程标题
|
* @param cateId 分类id
|
* @param pageCurr 分页参数,当前页码
|
* @param pageSize 分页参数,每页数量
|
* @return 课程分页列表
|
*/
|
@PostMapping("/getCoursePageList")
|
@ApiOperation(value = "获取课程列表-分页")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "课程标题", name = "courseTitle", required = false, dataType = "String"),
|
@ApiImplicitParam(value = "课程分类id", name = "cateId", required = false, dataType = "Long"),
|
@ApiImplicitParam(value = "分页参数,当前页码", name = "pageCurr", required = true, dataType = "Integer"),
|
@ApiImplicitParam(value = "分页参数,每页数量", name = "pageSize", required = true, dataType = "Integer")
|
})
|
public R<PageDTO<ClientCourseVO>> getCourseList(
|
@RequestParam(defaultValue = "", value = "courseTitle", required = false) String courseTitle,
|
@RequestParam(required = false) Long cateId,
|
@RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr,
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
return R.ok(courseService.getCoursePageList(courseTitle, cateId, pageCurr, pageSize));
|
}
|
}
|