package com.xinyilu.web.controller.physicalActionAnalysis;

import com.xinyilu.common.core.controller.BaseController;
import com.xinyilu.common.core.domain.AjaxResult;
import com.xinyilu.system.service.physicalActionAnalysis.PhysicalActionAnalysisService;
import org.apache.commons.lang3.StringUtils;
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 javax.annotation.Resource;
import java.util.Objects;

/**
 * @Description 幼儿身体素质/动作发展状况分析控制器
 * @Author 纪寒
 * @Date 2022-08-19 11:14:19
 * @Version 1.0
 */
@RestController
@RequestMapping("/physical/action")
public class PhysicalActionAnalysisController extends BaseController {

    @Resource
    private PhysicalActionAnalysisService physicalActionAnalysisService;

    /**
     * 根据幼儿园id和班级类型查询分析数据
     *
     * @param kindergartenId 幼儿园id
     * @param classType      班级类型
     * @return 分析数据结果
     */
    @PreAuthorize("@ss.hasPermi('physical:action:analysis')")
    @GetMapping("/analysis")
    public AjaxResult getPhysicalActionAnalysis(Long kindergartenId, String classType, String batchCode) {
        if (Objects.isNull(kindergartenId)) {
            return AjaxResult.error("请选择所属幼儿园信息！");
        }
        if (StringUtils.isBlank(classType)) {
            return AjaxResult.error("请选择班级类型！");
        }
        if (StringUtils.isBlank(batchCode)) {
            return AjaxResult.error("请选择所属批次！");
        }
        return physicalActionAnalysisService.getPhysicalActionAnalysis(kindergartenId, classType, batchCode);
    }
}
