From f0f00e9ba8a755e4317e029d73b69a92ad9f9df1 Mon Sep 17 00:00:00 2001 From: kongzy <kongzy> Date: 星期六, 14 九月 2024 17:02:41 +0800 Subject: [PATCH] update --- 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