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

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

/**
 * 习题表(ZccmQuestion)表控制层
 *
 * @author java
 * @since 2020-12-07 11:35:59
 */

@RestController
@RequestMapping("/new/api/front/question")
public class FrontQuestionController {

    /**
     * 服务对象
     */
    private final ZccmQuestionService questionService;

    public FrontQuestionController(ZccmQuestionService questionService) {
        this.questionService = questionService;
    }

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

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


}