package com.xhkjedu.sapi.controller.analyze;

import com.xhkjedu.sapi.service.analyze.SchoolRoomService;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import com.xhkjedu.sapi.vo.analyze.*;
import com.xhkjedu.sapi.vo.analyze.room.SchoolRoomVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName SchoolRoomController
 * Description TODO 课堂概况
 * Author WN
 * Date 2020/8/10 22:21
 **/
@RequestMapping("/schoolrm")
@RestController
public class SchoolRoomController {
    @Autowired
    private SchoolRoomService schoolRoomService;

    /**
     *功能描述 课堂概况--各学科统计
     * @author WN
     * @date 2020/8/10
     * @param  * @param srparams
     * @return com.xhkjedu.vo.ResultVo
     */
    @PostMapping("/room")
    public ResultVo listSchoolRoom(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        List<SchoolRoomSubjectVo> lst = schoolRoomService.listSchoolRoomSubject(srparams);
        return new ResultVo(0,"",lst);
    }

    /**
     *功能描述 课堂概况--总统计
     * @author WN
     * @date 2020/11/26
     * @param  * @param srparams
     * @return com.xhkjedu.vo.ResultVo
     */
    @PostMapping("/roomt")
    public ResultVo getSchoolRoom(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        SchoolRoomVo schoolRoomVo = schoolRoomService.getSchoolRoomTotal(srparams);
        return new ResultVo(0,"",schoolRoomVo);
    }

    /**
     *功能描述 课堂概况--学科详情
     * @author WN
     * @date 2020/8/10
     * @param  * @param srparams
     * @return com.xhkjedu.vo.ResultVo
     */
    @PostMapping("/roomd")
    public ResultVo listSchoolRoomDetail(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        List<SchoolRoomGradeUserVo> lst = schoolRoomService.listSchoolRoomDetailBySubject(srparams);
        return new ResultVo(0,"",lst);
    }
}
