package com.zhongzheng.controller.exam;

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.exam.bo.ExamNoteAddBo;
import com.zhongzheng.modules.exam.bo.ExamNoteEditBo;
import com.zhongzheng.modules.exam.bo.ExamNoteQueryBo;
import com.zhongzheng.modules.exam.service.IExamNoteService;
import com.zhongzheng.modules.exam.vo.ExamNoteVo;
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.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 考试重点Controller
 *
 * @author hjl
 * @date 2021-05-21
 */
@Api(value = "考试重点控制器", tags = {"考试重点管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/app/common/exam/note")
public class ExamNoteController extends BaseController {

    private final IExamNoteService iExamNoteService;

    /**
     * 查询考试重点列表
     */
    @ApiOperation("查询考试重点列表")
    @GetMapping("/list")
    public TableDataInfo<ExamNoteVo> list(ExamNoteQueryBo bo) {
        List<Integer> statusList = new ArrayList<>();
        statusList.add(1);
        bo.setStatus(statusList);
        startPage();
        List<ExamNoteVo> list = iExamNoteService.selectExamNoteList(bo);
        return getDataTable(list);
    }

    @ApiOperation("查询考试重点推荐列表")
    @GetMapping("/recommendList")
    public AjaxResult<List<ExamNoteVo>> recommendList(ExamNoteQueryBo bo) {
        List<ExamNoteVo> list = iExamNoteService.queryRecommendList(bo);
        return AjaxResult.success(list);
    }


    /**
     * 获取考试重点详细信息
     */
    @ApiOperation("获取考试重点详细信息")
    @GetMapping("/{fileId}")
    public AjaxResult<ExamNoteVo> getInfo(@PathVariable("fileId" ) Long fileId) {
        return AjaxResult.success(iExamNoteService.queryById(fileId));
    }

}
