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.QuestionBankChapterAddBo;
import com.zhongzheng.modules.bank.bo.QuestionBankChapterEditBo;
import com.zhongzheng.modules.bank.bo.QuestionBankChapterQueryBo;
import com.zhongzheng.modules.bank.service.IQuestionBankChapterService;
import com.zhongzheng.modules.bank.vo.QuestionBankChapterVo;
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("/app/common/bank/chapter")
public class QuestionBankChapterController extends BaseController {

    private final IQuestionBankChapterService iQuestionBankChapterService;

    /**
     * 查询题库大章列表
     */
    @ApiOperation("查询题库大章列表")
    @GetMapping("/list")
    public TableDataInfo<QuestionBankChapterVo> list(QuestionBankChapterQueryBo bo) {
        startPage();
        List<QuestionBankChapterVo> list = iQuestionBankChapterService.queryList(bo);
        return getDataTable(list);
    }



    /**
     * 获取题库大章详细信息
     */
    @ApiOperation("获取题库大章详细信息")
    @PreAuthorize("@ss.hasPermi('bank:chapter:query')")
    @GetMapping("/{bankChapterId}")
    public AjaxResult<QuestionBankChapterVo> getInfo(@PathVariable("bankChapterId" ) Long bankChapterId) {
        return AjaxResult.success(iQuestionBankChapterService.queryById(bankChapterId));
    }


}
