package com.xhkjedu.sapi.controller.region;

import com.xhkjedu.sapi.service.region.RSchoolAnalyzeService;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import com.xhkjedu.sapi.vo.region.RegionParam;
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 javax.annotation.Resource;
import java.util.Map;

/**
 * @author ywx
 * @classname RSchoolAnalyzeController
 * @description 区域后台统计--学校统计
 * @date 2021/7/7 11:25
 **/
@RestController
@RequestMapping("/rsanalyze")
public class RSchoolAnalyzeController {
    @Resource
    private RSchoolAnalyzeService rSchoolAnalyzeService;

    @PostMapping("/list_school")
    public ResultVo listSchool(@RequestBody RegionParam param){
        N_Utils.validation(new Object[]{param.getYear(),"学年",1});
        Map map = rSchoolAnalyzeService.listSchool(param);
        return new ResultVo(0,"获取学校列表成功",map);
    }

    @PostMapping("/list_teacher")
    public ResultVo listTeacher(@RequestBody RegionParam param){
        N_Utils.validation(new Object[]{param.getYear(),"学年",1});
        Map map = rSchoolAnalyzeService.listTeacher(param);
        return new ResultVo(0,"获取教师列表成功",map);
    }

    @PostMapping("/list_stu")
    public ResultVo listStu(@RequestBody RegionParam param){
        N_Utils.validation(new Object[]{param.getYear(),"学年",1});
        Map map = rSchoolAnalyzeService.listStu(param);
        return new ResultVo(0,"获取学生列表成功",map);
    }

    @PostMapping("/list_access")
    public ResultVo listAccess(@RequestBody RegionParam param){
        N_Utils.validation(new Object[]{param.getYear(),"学年",1});
        Map map = rSchoolAnalyzeService.listAccess(param);
        return new ResultVo(0,"获取活跃度统计成功",map);
    }
}
