package com.zhongzheng.controller.bank;

import com.zhongzheng.common.annotation.Log;
import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.common.core.page.TableDataInfo;
import com.zhongzheng.common.enums.BusinessType;
import com.zhongzheng.modules.bank.bo.QuestionAddBo;
import com.zhongzheng.modules.bank.bo.QuestionEditBo;
import com.zhongzheng.modules.bank.bo.QuestionQueryBo;
import com.zhongzheng.modules.bank.service.IQuestionService;
import com.zhongzheng.modules.bank.vo.QuestionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

/**
 * 题库题目Controller
 *
 * @author hjl
 * @date 2021-05-20
 */
@Api(value = "题库题目控制器", tags = {"题库题目管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/bank/question")
public class QuestionController extends BaseController {

    private final IQuestionService iQuestionService;

    /**
     * 查询题库题目列表
     */
    @ApiOperation("查询题库题目列表")
    @GetMapping("/list")
    public TableDataInfo<QuestionVo> list(QuestionQueryBo bo) {
        startPage();
        List<QuestionVo> list = iQuestionService.queryList(bo);
        return getDataTable(list);
    }

    /**
     * 获取题库题目详细信息
     */
    @ApiOperation("获取题库题目详细信息")
    @GetMapping("/{questionId}")
    public AjaxResult<QuestionVo> getInfo(@PathVariable("questionId" ) Long questionId) {
        return AjaxResult.success(iQuestionService.queryById(questionId));
    }



}
