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.QuestionBankSectionAddBo;
import com.zhongzheng.modules.bank.bo.QuestionBankSectionEditBo;
import com.zhongzheng.modules.bank.bo.QuestionBankSectionQueryBo;
import com.zhongzheng.modules.bank.service.IQuestionBankSectionService;
import com.zhongzheng.modules.bank.vo.QuestionBankSectionVo;
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/section")
public class QuestionBankSectionController extends BaseController {

    private final IQuestionBankSectionService iQuestionBankSectionService;

    /**
     * 查询题库小节列表
     */
    @ApiOperation("查询题库小节列表")
    @GetMapping("/list")
    public TableDataInfo<QuestionBankSectionVo> list(QuestionBankSectionQueryBo bo) {
        startPage();
        List<QuestionBankSectionVo> list = iQuestionBankSectionService.selectBankSectionList(bo);
        return getDataTable(list);
    }


    /**
     * 获取题库小节详细信息
     */
    @ApiOperation("获取题库小节详细信息")
    @GetMapping("/{bankSectionId}")
    public AjaxResult<QuestionBankSectionVo> getInfo(@PathVariable("bankSectionId" ) Long bankSectionId) {
        return AjaxResult.success(iQuestionBankSectionService.queryById(bankSectionId));
    }


}
