无关风月
2024-09-10 e0d10eddc8721e6447787ccb6807c00e1b0b91f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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));
    }
}