Browse Source

学生成绩录入

dzx 11 months ago
parent
commit
050b62fb93

+ 3 - 20
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreController.java

@@ -24,6 +24,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -62,30 +63,12 @@ public class ExamSubjectScoreController {
     @SaCheckPermission("examsubjectscore:enter-list")
     @XjrLog("根据录入id查询考试成绩")
     public RT<List<ExamSubjectScoreEnterImportVo>> enterList(@Valid ExamSubjectScoreEnterDto dto){
-        List<ExamSubjectScoreEnterImportVo> result = scoreService.selectJoinList(ExamSubjectScoreEnterImportVo.class,
-                new MPJLambdaWrapper<ExamSubjectScore>()
-                        .select(ExamSubjectScore::getId)
-                        .selectAs(BaseClass::getName, ExamSubjectScoreEnterImportVo::getClassName)
-                        .selectAs(User::getName, ExamSubjectScoreEnterImportVo::getStudentName)
-                        .selectAs(User::getCredentialNumber, ExamSubjectScoreEnterImportVo::getCredentialNumber)
-                        .select(ExamSubjectScore::getScore)
-                        .select(ExamSubjectScore::getClassRanking)
-                        .select(ExamSubjectScore::getGradeRanking)
-                        .innerJoin(User.class, User::getId, ExamSubjectScore::getUserId)
-                        .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, ExamSubjectScore::getUserId)
-                        .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
-                        .eq(dto.getClassId() != null, BaseClass::getId, dto.getClassId())
-                        .like(StrUtil.isNotEmpty(dto.getStudentName()), User::getName, dto.getStudentName())
-                        .like(StrUtil.isNotEmpty(dto.getCredentialNumber()), User::getCredentialNumber, dto.getCredentialNumber())
-                        .isNotNull(dto.getIsEnter() != null && dto.getIsEnter() == 1, ExamSubjectScore::getScore)
-                        .isNull(dto.getIsEnter() != null && dto.getIsEnter() == 1, ExamSubjectScore::getScore)
-                        .eq(dto.getExamSubjectScoreEnterId() != null, ExamSubjectScore::getExamSubjectScoreEnterId, dto.getExamSubjectScoreEnterId())
-        );
+        List<ExamSubjectScoreEnterImportVo> result = scoreService.getEnterScoreStudentList(dto);
         return RT.ok(result);
     }
 
 
-    @PostMapping
+    @PutMapping
     @ApiOperation(value = "修改学生成绩")
     @SaCheckPermission("examsubjectscore:update")
     @XjrLog("修改学生成绩")

+ 11 - 8
src/main/java/com/xjrsoft/module/xycxedu/controller/ExamSubjectScoreEnterController.java

@@ -2,18 +2,25 @@ package com.xjrsoft.module.xycxedu.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
-import com.alibaba.excel.EasyExcel;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
 import com.xjrsoft.module.xycxedu.dto.UpdateExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
 import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreEnterService;
+import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo;
 import io.swagger.annotations.Api;
@@ -31,9 +38,7 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -49,7 +54,6 @@ import java.util.List;
 @AllArgsConstructor
 public class ExamSubjectScoreEnterController {
 
-
     private final IExamSubjectScoreEnterService enterService;
 
     @GetMapping(value = "/page")
@@ -109,10 +113,9 @@ public class ExamSubjectScoreEnterController {
 
     @GetMapping("/export-query")
     @ApiOperation(value = "下载模板")
-    public ResponseEntity<byte[]> exportData(@Valid ExamSubjectScoreEnterDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
-        ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, ExamSubjectScoreEnterPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(new ArrayList<>());
+    public ResponseEntity<byte[]> exportData(@Valid ExamSubjectScoreEnterDto dto) throws IOException {
 
-        return RT.fileStream(bot.toByteArray(), "ExamSubjectScoreEnter" + ExcelTypeEnum.XLSX.getValue());
+        byte[] bytes = enterService.downloadTemplate(dto);
+        return RT.fileStream(bytes, "ExamSubjectScoreEnter" + ExcelTypeEnum.XLSX.getValue());
     }
 }

+ 3 - 1
src/main/java/com/xjrsoft/module/xycxedu/dto/UpdateExamSubjectScoreDto.java

@@ -3,6 +3,8 @@ package com.xjrsoft.module.xycxedu.dto;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.io.Serializable;
+
 
 /**
 * @title: 考试计划维护
@@ -11,7 +13,7 @@ import lombok.Data;
 * @Version 1.0
 */
 @Data
-public class UpdateExamSubjectScoreDto{
+public class UpdateExamSubjectScoreDto implements Serializable {
 
     private static final long serialVersionUID = 1L;
 

+ 3 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreEnterService.java

@@ -3,6 +3,7 @@ package com.xjrsoft.module.xycxedu.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
@@ -27,4 +28,6 @@ public interface IExamSubjectScoreEnterService extends MPJBaseService<ExamSubjec
     Page<ExamSubjectScoreEnterPageVo> getPage(Page<ExamSubjectScoreEnterPageVo> page, ExamSubjectScoreEnterPageDto dto);
 
     ExamSubjectScoreEnterVo getInfo(Long id);
+
+    byte[] downloadTemplate(ExamSubjectScoreEnterDto dto) throws IOException;
 }

+ 7 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/IExamSubjectScoreService.java

@@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 
+import java.util.List;
+
 /**
  * @title: 晓羊策学考试计划表
  * @Author dzx
@@ -22,4 +26,7 @@ public interface IExamSubjectScoreService extends MPJBaseService<ExamSubjectScor
     Page<ExamSubjectScorePageVo> getPage(Page<ExamSubjectScorePageVo> page, ExamSubjectScoreDto dto);
 
     Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, ExamStatisticsPageDto dto);
+
+
+    List<ExamSubjectScoreEnterImportVo> getEnterScoreStudentList(ExamSubjectScoreEnterDto dto);
 }

+ 146 - 2
src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreEnterServiceImpl.java

@@ -11,13 +11,15 @@ import com.xjrsoft.common.enums.ArchivesStatusEnum;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseCourseSubject;
-import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseCourseSubjectService;
+import com.xjrsoft.module.generator.entity.ImportConfig;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.veb.util.ImportExcelUtil;
 import com.xjrsoft.module.xycxedu.dto.AddExamSubjectScoreEnterDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterPageDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScoreEnter;
@@ -28,10 +30,22 @@ import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterPageVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo;
 import lombok.AllArgsConstructor;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
@@ -52,7 +66,6 @@ public class ExamSubjectScoreEnterServiceImpl extends MPJBaseServiceImpl<ExamSub
     private final IBaseCourseSubjectService courseSubjectService;
     private final IUserService userService;
     private final IExamSubjectScoreService scoreService;
-    private final IBaseClassService classService;
 
 
     @Override
@@ -155,4 +168,135 @@ public class ExamSubjectScoreEnterServiceImpl extends MPJBaseServiceImpl<ExamSub
     public ExamSubjectScoreEnterVo getInfo(Long id) {
         return this.baseMapper.getInfo(id);
     }
+
+    @Override
+    public byte[] downloadTemplate(ExamSubjectScoreEnterDto dto) throws IOException {
+        ExamSubjectScoreEnter scoreEnter = this.getById(dto.getExamSubjectScoreEnterId());
+        BaseCourseSubject courseSubject = courseSubjectService.getById(scoreEnter.getCourseSubjectId());
+
+        List<ExamSubjectScoreEnterImportVo> result = scoreService.getEnterScoreStudentList(dto);
+        List<ArrayList<String>> dataList = new ArrayList<>();
+        for (ExamSubjectScoreEnterImportVo recordVo : result) {
+            ArrayList<String> data = new ArrayList<>();
+            data.add(recordVo.getClassName());
+            data.add(recordVo.getStudentName());
+            data.add(recordVo.getCredentialNumber());
+            data.add(courseSubject.getName());
+            data.add(recordVo.getScore());
+            data.add(recordVo.getClassRanking() + "");
+            data.add(recordVo.getGradeRanking() + "");
+            dataList.add(data);
+        }
+
+        Workbook workbook = new XSSFWorkbook();
+        // 创建一个工作表(sheet)
+        String sheetName = "数据";
+        Sheet sheet = workbook.createSheet(sheetName);
+
+        createFirstTitle(workbook, sheet);
+        createSecondTitle(workbook, sheet);
+        createThirdTitle(workbook, sheet, ExamSubjectScoreEnterImportVo.class);
+
+        int dataRowNumber = 3;
+
+        for (ArrayList<String> rowData : dataList) {
+            Row dataRow = sheet.createRow(dataRowNumber);
+            for (int i = 0; i < rowData.size(); i ++){
+                if(dataRowNumber == 3){
+                    sheet.autoSizeColumn(i);
+                }
+                String content = rowData.get(i);
+                Font font = workbook.createFont();
+                font.setBold(false);// 设置为粗体
+                font.setFontName("宋体");
+                font.setFontHeightInPoints((short)12);
+
+                CellStyle cellStyle = workbook.createCellStyle();
+                cellStyle.setFont(font); // 将字体应用到样式
+                cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+                Cell row1cell2 = dataRow.createCell(i);
+                row1cell2.setCellValue(content);
+                row1cell2.setCellStyle(cellStyle);
+            }
+
+            dataRowNumber ++;
+        }
+
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        workbook.write(bot);
+        return bot.toByteArray();
+    }
+
+    void createFirstTitle(Workbook workbook, Sheet sheet) {
+        int rowNumber = 0;
+        Font font = workbook.createFont();
+        font.setBold(true);// 设置为粗体
+        font.setFontName("宋体");
+//        font.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+        font.setFontHeightInPoints((short)24);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        Row row = sheet.createRow(rowNumber);
+        //合并第一行的列
+        sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, 6));
+
+        //3、处理表头
+        String title1 = "学生成绩导入模板";
+        // 创建单元格并设置值
+        Cell cell = row.createCell(0);
+        cell.setCellValue(title1);
+        cell.setCellStyle(cellStyle);
+    }
+
+    void createSecondTitle(Workbook workbook, Sheet sheet) {
+        int rowNumber = 1;
+        Font font = workbook.createFont();
+        font.setBold(true);// 设置为粗体
+        font.setFontName("宋体");
+        font.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        Row row = sheet.createRow(rowNumber);
+        //合并第一行的列
+        sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, 0, 6));
+
+        //3、处理表头
+        String title1 = "说明:导入的学生信息必须保证与系统现有信息一致,导入时请将示例数据删除,避免导入失败!黄底红字为必填项,白底黑字为非必填项;";
+        // 创建单元格并设置值
+        Cell cell = row.createCell(0);
+        cell.setCellValue(title1);
+        cell.setCellStyle(cellStyle);
+    }
+
+    void createThirdTitle(Workbook workbook, Sheet sheet, Class<?> clazz) {
+        int rowNumber = 2;
+        Font font = workbook.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+
+        Row row1 = sheet.createRow(rowNumber);
+        List<ImportConfig> importConfigs = ImportExcelUtil.allFields(clazz);
+        for(int i = 0; i < importConfigs.size(); i ++){
+            ImportConfig importConfig = importConfigs.get(i);
+            Cell rowcell = row1.createCell(i);
+            rowcell.setCellValue(importConfig.getFieldName());
+            rowcell.setCellStyle(cellStyle);
+
+        }
+    }
 }

+ 33 - 0
src/main/java/com/xjrsoft/module/xycxedu/service/impl/ExamSubjectScoreServiceImpl.java

@@ -1,17 +1,26 @@
 package com.xjrsoft.module.xycxedu.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.xycxedu.dto.ExamStatisticsPageDto;
 import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreDto;
+import com.xjrsoft.module.xycxedu.dto.ExamSubjectScoreEnterDto;
 import com.xjrsoft.module.xycxedu.entity.ExamSubjectScore;
 import com.xjrsoft.module.xycxedu.mapper.ExamSubjectScoreMappper;
 import com.xjrsoft.module.xycxedu.service.IExamSubjectScoreService;
 import com.xjrsoft.module.xycxedu.vo.ExamStatisticsPageVo;
+import com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterImportVo;
 import com.xjrsoft.module.xycxedu.vo.ExamSubjectScorePageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @title: 晓羊策学考试计划表
  * @Author dzx
@@ -35,4 +44,28 @@ public class ExamSubjectScoreServiceImpl extends MPJBaseServiceImpl<ExamSubjectS
     public Page<ExamStatisticsPageVo> getStatisticsPage(Page<ExamStatisticsPageVo> page, ExamStatisticsPageDto dto) {
         return this.baseMapper.getStatisticsPage(page, dto);
     }
+
+    @Override
+    public List<ExamSubjectScoreEnterImportVo> getEnterScoreStudentList(ExamSubjectScoreEnterDto dto) {
+        List<ExamSubjectScoreEnterImportVo> result = this.selectJoinList(ExamSubjectScoreEnterImportVo.class,
+                new MPJLambdaWrapper<ExamSubjectScore>()
+                        .select(ExamSubjectScore::getId)
+                        .selectAs(BaseClass::getName, ExamSubjectScoreEnterImportVo::getClassName)
+                        .selectAs(User::getName, ExamSubjectScoreEnterImportVo::getStudentName)
+                        .selectAs(User::getCredentialNumber, ExamSubjectScoreEnterImportVo::getCredentialNumber)
+                        .select(ExamSubjectScore::getScore)
+                        .select(ExamSubjectScore::getClassRanking)
+                        .select(ExamSubjectScore::getGradeRanking)
+                        .innerJoin(User.class, User::getId, ExamSubjectScore::getUserId)
+                        .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, ExamSubjectScore::getUserId)
+                        .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
+                        .eq(dto.getClassId() != null, BaseClass::getId, dto.getClassId())
+                        .like(StrUtil.isNotEmpty(dto.getStudentName()), User::getName, dto.getStudentName())
+                        .like(StrUtil.isNotEmpty(dto.getCredentialNumber()), User::getCredentialNumber, dto.getCredentialNumber())
+                        .isNotNull(dto.getIsEnter() != null && dto.getIsEnter() == 1, ExamSubjectScore::getScore)
+                        .isNull(dto.getIsEnter() != null && dto.getIsEnter() == 1, ExamSubjectScore::getScore)
+                        .eq(dto.getExamSubjectScoreEnterId() != null, ExamSubjectScore::getExamSubjectScoreEnterId, dto.getExamSubjectScoreEnterId())
+        );
+        return result;
+    }
 }

+ 6 - 5
src/main/resources/mapper/xycxedu/ExamSubjectScoreEnterMappper.xml

@@ -26,15 +26,16 @@
         order by t1.id desc
     </select>
     <select id="getInfo" resultType="com.xjrsoft.module.xycxedu.vo.ExamSubjectScoreEnterVo">
-        SELECT t1.id, t2.name AS semester_name,t3.name AS exam_plan_name,t4.name AS course_subject_name,t1.create_date,t5.name create_user_name,
-        (SELECT GROUP_CONCAT(NAME) FROM base_class WHERE t1.class_ids LIKE CONCAT('%', id, '%')) AS class_name,
-        (select count(*) from exam_subject_score where delete_mark = 0 and exam_subject_score_enter_id = t1.id and enabled_mark = 1 score is null) as all_count,
-        (select count(*) from exam_subject_score where delete_mark = 0 and exam_subject_score_enter_id = t1.id and enabled_mark = 1 score is not null) as handle_count FROM exam_subject_score_enter t1
+        SELECT t1.id, t2.name AS semester_name,t3.name AS exam_plan_name,t4.name AS course_subject_name,t1.create_date,t5.name create_user_name
+        ,(SELECT GROUP_CONCAT(NAME) FROM base_class WHERE t1.class_ids LIKE CONCAT('%', id, '%')) AS class_name
+        ,(SELECT COUNT(*) FROM exam_subject_score WHERE delete_mark = 0 AND exam_subject_score_enter_id = t1.id AND enabled_mark = 1 AND score IS NULL) AS all_count
+        ,(SELECT COUNT(*) FROM exam_subject_score WHERE delete_mark = 0 AND exam_subject_score_enter_id = t1.id AND enabled_mark = 1 AND score IS NOT NULL) AS handle_count
+        FROM exam_subject_score_enter t1
         LEFT JOIN base_semester t2 ON t1.semester_id = t2.id
         LEFT JOIN exam_plan t3 ON t1.exam_plan_id = t3.id
         LEFT JOIN base_course_subject t4 ON t1.course_subject_id = t4.id
         LEFT JOIN xjr_user t5 ON t1.create_user_id = t5.id
         WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
-        and t1.id #{id}
+        and t1.id = #{id}
     </select>
 </mapper>