|  | @@ -1,11 +1,25 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.education.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  | +import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.base.PageResponse;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.entity.StudentAttendance;
 | 
	
		
			
				|  |  |  import com.ym.mec.education.entity.StudentRegistration;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.education.mapper.StudentRegistrationMapper;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.req.ClassGroupReq;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.resp.StudentRegistrationResp;
 | 
	
		
			
				|  |  | +import com.ym.mec.education.service.IStudentAttendanceService;
 | 
	
		
			
				|  |  |  import com.ym.mec.education.service.IStudentRegistrationService;
 | 
	
		
			
				|  |  | -import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * <p>
 | 
	
		
			
				|  |  |   * 学生报名表 服务实现类
 | 
	
	
		
			
				|  | @@ -17,4 +31,30 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class StudentRegistrationServiceImpl extends ServiceImpl<StudentRegistrationMapper, StudentRegistration> implements IStudentRegistrationService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IStudentAttendanceService studentAttendanceService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public PageResponse getPage(ClassGroupReq classGroupReq) {
 | 
	
		
			
				|  |  | +        Page<StudentRegistration> studentRegistrationPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
 | 
	
		
			
				|  |  | +        QueryWrapper<StudentRegistration> studentRegistrationQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +        studentRegistrationQueryWrapper.lambda().eq(true, StudentRegistration::getClassGroupId, classGroupReq.getGroupId());
 | 
	
		
			
				|  |  | +        IPage<StudentRegistration> page = page(studentRegistrationPage, studentRegistrationQueryWrapper);
 | 
	
		
			
				|  |  | +        Page<StudentRegistrationResp> studentRegistrationRespPage = new Page<>();
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(page, studentRegistrationRespPage);
 | 
	
		
			
				|  |  | +        List<StudentRegistrationResp> list = Lists.newArrayList();
 | 
	
		
			
				|  |  | +        page.getRecords().forEach(item -> {
 | 
	
		
			
				|  |  | +            QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | +            //请假 旷课正常上课次数
 | 
	
		
			
				|  |  | +            queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
 | 
	
		
			
				|  |  | +                    .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
 | 
	
		
			
				|  |  | +                            StudentAttendanceStatusEnum.LEAVE.getCode());
 | 
	
		
			
				|  |  | +            int count = studentAttendanceService.count(queryWrapper);
 | 
	
		
			
				|  |  | +            StudentRegistrationResp studentRegistrationResp = new StudentRegistrationResp()
 | 
	
		
			
				|  |  | +                    .setStudentName(item.getName()).setStudentAttendance("连续缺到" + count + "次");
 | 
	
		
			
				|  |  | +            list.add(studentRegistrationResp);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        studentRegistrationRespPage.setRecords(list);
 | 
	
		
			
				|  |  | +        return PageResponse.success(studentRegistrationRespPage);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |