From c600eb961aee6d178271d334beac7dd19f8fc289 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期五, 17 十月 2025 09:13:22 +0800
Subject: [PATCH] 修改

---
 multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
index 114bc30..dbe9429 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
@@ -8,13 +8,18 @@
 import com.gkhy.exam.common.utils.PageUtils;
 import com.gkhy.exam.common.utils.SecurityUtils;
 import com.gkhy.exam.system.domain.ExExamRecord;
+import com.gkhy.exam.system.domain.ExStudent;
 import com.gkhy.exam.system.domain.RecordFile;
 import com.gkhy.exam.system.mapper.ExExamRecordMapper;
+import com.gkhy.exam.system.mapper.ExStudentMapper;
 import com.gkhy.exam.system.service.ExExamRecordService;
 import org.ehcache.core.util.CollectionUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -29,6 +34,10 @@
 public class ExExamRecordServiceImpl extends ServiceImpl<ExExamRecordMapper, ExExamRecord> implements ExExamRecordService {
 
 
+    @Autowired
+    private ExStudentMapper studentMapper;
+
+
     @Override
     public CommonPage selectExamRecordList(ExExamRecord examRecord) {
         SysUser user= SecurityUtils.getLoginUser().getUser();
@@ -40,6 +49,13 @@
         for (ExExamRecord exExamRecord : recordList) {
             List<RecordFile> recordFiles = baseMapper.selectFiles(exExamRecord.getId());
             exExamRecord.setFiles(recordFiles);
+            List<ExStudent> exStudents = new ArrayList<>();
+            String[] split = exExamRecord.getStudentId().split(",");
+            for (String studentId : split) {
+                ExStudent exStudent = studentMapper.selectStudentById(Long.valueOf(studentId));
+                exStudents.add(exStudent);
+            }
+            exExamRecord.setStudents(exStudents);
         }
         return CommonPage.restPage(recordList);
     }
@@ -49,6 +65,13 @@
         ExExamRecord exExamRecord = baseMapper.selectExamRecordById(recordId);
         List<RecordFile> recordFiles = baseMapper.selectFiles(exExamRecord.getId());
         exExamRecord.setFiles(recordFiles);
+        List<ExStudent> exStudents = new ArrayList<>();
+        String[] split = exExamRecord.getStudentId().split(",");
+        for (String studentId : split) {
+            ExStudent exStudent = studentMapper.selectStudentById(Long.valueOf(studentId));
+            exStudents.add(exStudent);
+        }
+        exExamRecord.setStudents(exStudents);
         return exExamRecord;
     }
 
@@ -59,7 +82,7 @@
         examRecord.setCreateBy(SecurityUtils.getUsername());
         int row=baseMapper.insert(examRecord);
         List<RecordFile> files = examRecord.getFiles();
-        if (!files.isEmpty()){
+        if (!CollectionUtils.isEmpty(files)){
             baseMapper.insertFile(files,examRecord.getId());
         }
         if(row<1){

--
Gitblit v1.9.2