Blame view

SubjectSemesterServiceImpl.java 3.69 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
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);
    }

}