package com.hc.web.controller.browser.front;

import com.hc.business.service.CourseTypeService;
import com.hc.core.utils.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;


/**
 * (CourseType)表控制层
 *
 * @author java
 * @since 2020-12-17 14:12:55
 */

@RestController
@RequestMapping("/new/api/front/courseType")
public class FrontCourseTypeController {

    /**
     * 服务对象
     */
    private final CourseTypeService courseTypeService;

    public FrontCourseTypeController(CourseTypeService courseTypeService) {
        this.courseTypeService = courseTypeService;
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "依据主键获取 CourseType", response = Result.class)
    public Result selectFrontCourseType(@PathVariable("id") Integer id) {
        return Result.success(this.courseTypeService.queryById(id));
    }

    @GetMapping("/list")
    @ApiOperation(value = "获取 CourseType列表(分页)", response = Result.class)
    public Result listFrontCourseType(@RequestParam(defaultValue = "0") Integer page,
                                      @RequestParam(defaultValue = "0") Integer size) {
        return Result.success(courseTypeService.queryAllByLimit(page, size));
    }


}