kongzy
2024-07-05 14821e28286d773ad5ff2c13510e39c5eb117daf
exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExPaperStudentServiceImpl.java
@@ -128,14 +128,14 @@
    @Override
    public int deletePaperStudent(Long paperStudentId) {
        ExPaperStudent paperStudent=baseMapper.selectPaperStudentById(paperStudentId);
        ExPaperStudent paperStudent=baseMapper.selectSimplePaperStudentById(paperStudentId);
        if(ObjectUtil.isNull(paperStudent)){
            throw new ApiException(String.format("该试卷下不存在该学员<>",paperStudent.getStudentName()));
            throw new ApiException("学员与试卷关系不存在");
        }
        checkUserAllowed(paperStudent);
        int studentAnswerCount=studentAnswerMapper.countByPaperId(paperStudent.getPaperId(),paperStudent.getStudentId());
        if(studentAnswerCount>0){
            throw new ApiException(String.format("学员<%s>已进行答题,不能删除",paperStudent.getStudentName()));
            throw new ApiException("学员已进行答题,不能删除");
        }
        //删除学员与试卷关系
        return baseMapper.deleteById(paperStudentId);