From 8458e64aab474c0fc2f49ae4ff22fb11ce5cf6e2 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期一, 11 十一月 2024 16:55:28 +0800
Subject: [PATCH] 批次新增学员查询条件,新增题目导入接口

---
 exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
index a0479b9..814f370 100644
--- a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
+++ b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamRecordServiceImpl.java
@@ -46,6 +46,8 @@
     @Override
     public int insertExamRecord(ExExamRecord examRecord) {
         checkUserAllowed(examRecord);
+        examRecord.setCompanyId(SecurityUtils.getLoginUser().getUser().getCompanyId());
+        examRecord.setCreateBy(SecurityUtils.getUsername());
         int row=baseMapper.insert(examRecord);
         if(row<1){
             throw new ApiException("新增登记记录失败");
@@ -56,6 +58,7 @@
     @Override
     public int updateExamRecord(ExExamRecord examRecord) {
         checkUserAllowed(examRecord);
+        examRecord.setUpdateBy(SecurityUtils.getUsername());
         int row=baseMapper.updateById(examRecord);
         if(row<1){
             throw new ApiException("更新登记记录失败");
@@ -72,12 +75,12 @@
     public void checkUserAllowed(ExExamRecord examRecord) {
         SysUser currentUser= SecurityUtils.getLoginUser().getUser();
         if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){
-            return;
+            throw new ApiException("管理员没有权限操作");
         }
         if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){
             throw new ApiException("没有权限操作");
         }
-        if(!currentUser.getCompanyId().equals(examRecord.getCompanyId())){
+        if(examRecord.getCompanyId()!=null&&!currentUser.getCompanyId().equals(examRecord.getCompanyId())){
             throw new ApiException("没有权限操作其他企业登记记录");
         }
     }

--
Gitblit v1.9.2