package com.yida.data.school.health.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.health.EduGrade;
import com.yida.data.common.core.entity.health.EduNationalStandardProjectWeight;
import com.yida.data.school.health.mapper.EduGradeMapper;
import com.yida.data.school.health.service.EduGradeService;
import com.yida.data.school.vo.health.ProjectVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * 年级的基础信息表 Service实现
 *
 * @author wjm
 * @date 2021-09-14 17:16:22
 */
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class EduGradeServiceImpl extends ServiceImpl
        <EduGradeMapper, EduGrade> implements EduGradeService {

    private final EduGradeMapper eduGradeMapper;

    @Override
    public List<ProjectVO> findGradeProject(Long gradeId, Integer sexType) {
        List<EduNationalStandardProjectWeight> gradeProject = baseMapper.findGradeProject(gradeId, sexType);


        List<ProjectVO> list = new ArrayList<>();
        for (EduNationalStandardProjectWeight project : gradeProject) {
            ProjectVO projectVO = new ProjectVO();


            switch (project.getId().intValue()) {
                case 1:
                    projectVO.setProjectName("身高");
                    projectVO.setProject("height");
                    projectVO.setExample("请输入身高，单位（cm）");
                    ProjectVO projectVO1 = new ProjectVO();
                    projectVO1.setProjectName("体重");
                    projectVO1.setProject("wight");
                    projectVO1.setExample("请输入体重，单位（kg）");
                    list.add(projectVO);
                    list.add(projectVO1);
                    break;
                case 2:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("lungCapacity");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 22:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("leftEye");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 23:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("rightEye");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 3:
                case 10:
                case 6:
                case 15:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("stu50MeterRace");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 4:
                case 7:
                case 11:
                case 16:

                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("stuBodyFlexion");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 5:
                case 8:
                case 12:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("ropeSkipping");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 9:
                case 13:
                case 19:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("oneMinuteSitUp");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 14:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("stu50MeterRaceBack");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 17:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("standingJump");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 18:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("pullUp");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 20:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("meterRace1000");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                case 21:
                    projectVO.setProjectName(project.getProjectName());
                    projectVO.setProject("meterRace800");
                    projectVO.setExample(project.getExample());
                    list.add(projectVO);
                    break;
                default:
            }
        }


        return list;
    }
}
