package com.xinyilu.web.controller.testAllStudentScoreinfo;

import com.xinyilu.common.core.controller.BaseController;
import com.xinyilu.common.core.domain.AjaxResult;
import com.xinyilu.system.service.testAllStudentScoreinfo.ITestAllStudentScoreService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;


/**
 * @author ljh
 * @version 1.0
 * Create by 2022/8/12 19:59
 */


@RestController
@RequestMapping("/system/testAll")
public class TestAllStudentScoreController extends BaseController {

    @Autowired
    private ITestAllStudentScoreService testAllStudentScoreService;


    /**
     * 获取所有学生的学生姓名以及成绩
     *
     * @param kindergartenId 幼儿园id/kindergarten/side/analysis
     * @param batchCode      批次编号
     * @return com.xinyilu.system.domain.vo.TestItemScoreinfoVO
     **/
    @PreAuthorize("@ss.hasPermi('system:testAll:list')")
    @GetMapping("/StudentList")
    public AjaxResult studentList(@Param("kindergartenId") Long kindergartenId, @Param("batchCode") String batchCode) {
        if (Objects.isNull(kindergartenId)) {
            return AjaxResult.error("请选择所属幼儿园信息！");
        }
        if (Objects.isNull(batchCode)) {
            return AjaxResult.error("请选择所属批次！");
        }
        return AjaxResult.success(testAllStudentScoreService.selectAllStudentScoreList(kindergartenId, batchCode));
    }
}
