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

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


/**
 * 试卷表(Paper)表控制层
 *
 * @author java
 * @since 2020-12-07 11:34:40
 */

@RestController
@RequestMapping("/new/api/front/paper")
public class FrontPaperController {

    /**
     * 服务对象
     */
    private final PaperService paperService;

    public FrontPaperController(PaperService paperService) {
        this.paperService = paperService;
    }

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

    @GetMapping("/detail")
    @ApiOperation(value = "前台用户获取 Paper", response = Result.class)
    public Result selectFrontPaperDetail(@ApiParam(value = "试卷id") @RequestParam Integer paperId) {
        return Result.success(paperService.queryQuestionList(paperId));
    }


}