package com.xhkjedu.smarking.controller.papercheck;

import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacherScoreset;
import com.xhkjedu.smarking.service.papercheck.MsPaperCheckTeacherScoresetService;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description 阅卷批阅教师常用分设置表相关操作
 * @Author auto
 * @Date 2024-10-15
 */
@RestController
@RequestMapping("/mscoreset")
public class MsPaperCheckTeacherScoresetController {
    @Resource
    private MsPaperCheckTeacherScoresetService msPaperCheckTeacherScoresetService;

    /**
     * @Description 设置常用分
     * @Date 2024/11/1 14:35
     * @Author YWX
     * @Param [set]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/save")
    public ResultVo save(@RequestBody MsPaperCheckTeacherScoreset set) {
        N_Utils.validation(new Object[]{set.getExamid(), "考试id", 1, set.getTeacherid(), "教师id", 1});
        msPaperCheckTeacherScoresetService.add(set);
        return new ResultVo(0, "保存成功");
    }

    /**
     * @Description 常用给分详情
     * @Date 2024/11/1 14:41
     * @Author YWX
     * @Param [set]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/detail")
    public ResultVo detail(@RequestBody MsPaperCheckTeacherScoreset set) {
        N_Utils.validation(new Object[]{set.getExamid(), "考试id", 1, set.getTeacherid(), "教师id", 1});
        MsPaperCheckTeacherScoreset scoreset = msPaperCheckTeacherScoresetService.findByExamIdAndTeacherId(set.getExamid(), set.getTeacherid());
        return new ResultVo(0, "查询成功", scoreset);
    }
}
