From 75309a59a676fb70f91dd01b05d93c7704a3836f Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期三, 23 七月 2025 15:06:39 +0800 Subject: [PATCH] 新增培训计划 --- multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 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 814f370..114bc30 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,8 +8,10 @@ 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.RecordFile; import com.gkhy.exam.system.mapper.ExExamRecordMapper; import com.gkhy.exam.system.service.ExExamRecordService; +import org.ehcache.core.util.CollectionUtil; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -35,20 +37,31 @@ } PageUtils.startPage(); List<ExExamRecord> recordList=baseMapper.selectExamRecordList(examRecord); + for (ExExamRecord exExamRecord : recordList) { + List<RecordFile> recordFiles = baseMapper.selectFiles(exExamRecord.getId()); + exExamRecord.setFiles(recordFiles); + } return CommonPage.restPage(recordList); } @Override public ExExamRecord selectExamRecordById(Long recordId) { - return baseMapper.selectExamRecordById(recordId); + ExExamRecord exExamRecord = baseMapper.selectExamRecordById(recordId); + List<RecordFile> recordFiles = baseMapper.selectFiles(exExamRecord.getId()); + exExamRecord.setFiles(recordFiles); + return exExamRecord; } @Override public int insertExamRecord(ExExamRecord examRecord) { checkUserAllowed(examRecord); - examRecord.setCompanyId(SecurityUtils.getLoginUser().getUser().getCompanyId()); +// examRecord.setCompanyId(SecurityUtils.getLoginUser().getUser().getCompanyId()); examRecord.setCreateBy(SecurityUtils.getUsername()); int row=baseMapper.insert(examRecord); + List<RecordFile> files = examRecord.getFiles(); + if (!files.isEmpty()){ + baseMapper.insertFile(files,examRecord.getId()); + } if(row<1){ throw new ApiException("新增登记记录失败"); } @@ -60,6 +73,11 @@ checkUserAllowed(examRecord); examRecord.setUpdateBy(SecurityUtils.getUsername()); int row=baseMapper.updateById(examRecord); + List<RecordFile> files = examRecord.getFiles(); + baseMapper.deletedFile(examRecord.getId()); + if (!files.isEmpty()){ + baseMapper.insertFile(files, examRecord.getId()); + } if(row<1){ throw new ApiException("更新登记记录失败"); } @@ -69,13 +87,14 @@ @Override public int deleteExamRecordById(Long recordId) { checkUserAllowed(baseMapper.selectById(recordId)); + baseMapper.deletedFile(recordId); return baseMapper.deleteById(recordId); } public void checkUserAllowed(ExExamRecord examRecord) { SysUser currentUser= SecurityUtils.getLoginUser().getUser(); if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ - throw new ApiException("管理员没有权限操作"); + return; } if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){ throw new ApiException("没有权限操作"); -- Gitblit v1.9.2