package cn.iocoder.yudao.module.exam.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.exam.entity.ExamBatchItem;
import cn.iocoder.yudao.module.exam.service.ExamBatchItemService;
import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO;
import cn.iocoder.yudao.module.exam.vo.ExamBatchVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 考试批次子表")
@RestController
@RequestMapping("/examBatchItem")
@Validated
public class ExamBatchItemController {

    @Resource
    private ExamBatchItemService examBatchItemService;


    /**
     * 获得所有待录入成绩的学员列表
     * @author vinjor-M
     * @date 11:09 2025/1/21
    **/
    @GetMapping("/page")
    @Operation(summary = "获得所有待录入成绩的学员列表")
    public CommonResult<IPage<?>> getPage(ExamBatchVO pageReqVO,
                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Page<ExamBatchItemVO> page = new Page<>(pageNo,pageSize);
        return success(examBatchItemService.queryListPage(pageReqVO,page));
    }


    @PutMapping("/update")
    @Operation(summary = "录入考试成绩")
    public CommonResult<?> updateObj( @RequestBody ExamBatchItemVO examBatchVO) {
        examBatchItemService.updateObj(examBatchVO);
        return success(true);
    }

}