SubjectSemesterServiceImpl.java 3.69 KB
package com.meishu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.meishu.dto.semester.GetSemesterScoreDTO;
import com.meishu.dto.semester.GetStudentDetailDTO;
import com.meishu.dto.semester.GetStudentRecordDTO;
import com.meishu.mapper.ClassesDictHistoryMapper;
import com.meishu.mapper.ClassesDictMapper;
import com.meishu.model.ClassesDictDO;
import com.meishu.model.ClassesDictHistoryDO;
import com.meishu.model.SubjectSemesterDO;
import com.meishu.mapper.SubjectSemesterMapper;
import com.meishu.service.SubjectSemesterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meishu.vo.semester.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Tuyp
 * @since 2021-08-11
 */
@Service
public class SubjectSemesterServiceImpl extends ServiceImpl<SubjectSemesterMapper, SubjectSemesterDO> implements SubjectSemesterService {

    @Autowired
    private ClassesDictMapper classesDictMapper;

    @Autowired
    private ClassesDictHistoryMapper classesDictHistoryMapper;

    public List<GetAllStudyingSemesterVO> getAllStudyingSemester() {

        List<GetAllStudyingSemesterVO> result = new ArrayList<>();

        String[] array = new String[]{"高一", "高二", "高三"};

        for (String str : array) {
            GetAllStudyingSemesterVO subjectSemesterServiceVO = new GetAllStudyingSemesterVO();
            subjectSemesterServiceVO.setGradeType(str);
            subjectSemesterServiceVO.setClassesDictDOS(classesDictMapper.getGradeClasses(str));
            result.add(subjectSemesterServiceVO);
        }
        return result;
    }

    public  List<GetAllPastSemesterVO> getAllPastSemester(){

        List<GetAllPastSemesterVO> result = new ArrayList<>();

        String[] array = new String[]{"高一", "高二", "高三"};

        for (String str : array) {
            GetAllPastSemesterVO getAllPastSemesterVO = new GetAllPastSemesterVO();
            getAllPastSemesterVO.setGradeType(str);
            getAllPastSemesterVO.setClassesDictDOS(classesDictHistoryMapper.getAllPastSemester(str));
            result.add(getAllPastSemesterVO);
        }
        return result;
    }

    public IPage<GetSemesterScoreVO> getSemesterScore(GetSemesterScoreDTO getSemesterScoreDTO) {
        Page pager = new Page(getSemesterScoreDTO.getPageNum(), getSemesterScoreDTO.getPageSize());
        return this.baseMapper.getSemesterScore(pager, getSemesterScoreDTO.getSemester(), getSemesterScoreDTO.getGrade(), getSemesterScoreDTO.getClasses(), getSemesterScoreDTO.getSession(), getSemesterScoreDTO.getSubject(), getSemesterScoreDTO.getUserName());
    }

    public List<GetSemesterScoreVO> exportScore(GetSemesterScoreDTO getSemesterScoreDTO) {
        return this.baseMapper.exportScore(getSemesterScoreDTO.getSemester(), getSemesterScoreDTO.getGrade(),getSemesterScoreDTO.getClasses(),getSemesterScoreDTO.getSession(), getSemesterScoreDTO.getSubject(), getSemesterScoreDTO.getUserName());
    }

    public IPage<GetStudentDetailVO> getStudentDetail(GetStudentDetailDTO getStudentDetailDTO) {
        Page pager = new Page(getStudentDetailDTO.getPageNum(), getStudentDetailDTO.getPageSize());
        return this.baseMapper.getStudentDetail(pager, getStudentDetailDTO.getId(), getStudentDetailDTO.getUserId());
    }

    public List<GetStudentRecordVO> getStudentRecord(GetStudentRecordDTO getStudentRecordDTO){
        return this.baseMapper.getStudentRecord(getStudentRecordDTO);
    }

}