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

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


/**
 * (ClassConfigSponsor)表控制层
 *
 * @author java
 * @since 2021-05-28 14:11:29
 */

@RestController
@RequestMapping("/new/api/front/classConfigSponsor")
public class FrontClassConfigSponsorController {

    /**
     * 服务对象
     */
    private final ClassConfigSponsorService classConfigSponsorService;

    public FrontClassConfigSponsorController(ClassConfigSponsorService classConfigSponsorService) {
        this.classConfigSponsorService = classConfigSponsorService;
    }

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

    @GetMapping("/list")
    @ApiOperation(value = "获取 ClassConfigSponsor列表(分页)", response = Result.class)
    public Result listClassConfigSponsor(@RequestParam(defaultValue = "0") Integer page,
                                         @RequestParam(defaultValue = "0") Integer size,
                                         @RequestParam(required = false) Integer classId) {
        return Result.success(classConfigSponsorService.queryAllByLimit(page, size, classId));
    }


}
