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.QuestionBankExamAddBo;
import com.zhongzheng.modules.bank.bo.QuestionBankExamEditBo;
import com.zhongzheng.modules.bank.bo.QuestionBankExamQueryBo;
import com.zhongzheng.modules.bank.service.IQuestionBankExamService;
import com.zhongzheng.modules.bank.vo.QuestionBankExamVo;
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.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/exam")
public class QuestionBankExamController extends BaseController {

    private final IQuestionBankExamService iQuestionBankExamService;

    /**
     * 查询题库试卷列表
     */
    @ApiOperation("查询题库试卷列表")
    @GetMapping("/list")
    public TableDataInfo<QuestionBankExamVo> list(QuestionBankExamQueryBo bo) {
        startPage();
        List<QuestionBankExamVo> list = iQuestionBankExamService.selectBankExamList(bo);
        return getDataTable(list);
    }


    /**
     * 获取题库试卷详细信息
     */
    @ApiOperation("获取题库试卷详细信息")
    @GetMapping("/{examId}")
    public AjaxResult<QuestionBankExamVo> getInfo(@PathVariable("examId" ) Long examId) {
        return AjaxResult.success(iQuestionBankExamService.queryById(examId));
    }

}
