Exemplo n.º 1
0
 @Override
 public boolean removeAssessmentById(Integer assessmentId) {
   if (null != assessmentId && assessmentId != 0) {
     List<FileDO> files = assessmentFileCfgDOMapper.selectFilesByAssessmentId(assessmentId);
     int count1 = 0, count2 = 0;
     if (files.size() > 0) {
       List<Integer> fileIds = new ArrayList<>();
       for (FileDO dO : files) {
         fileIds.add(dO.getFileId());
       }
       count1 = fileDOMapper.logicalRemove(fileIds);
       count2 = assessmentFileCfgDOMapper.deleteByAssessmentId(assessmentId);
     }
     int count3 = assemblyPublishAssessmentDOMapper.deleteByPrimaryKey(assessmentId);
     return (count1 > 0 && count2 > 0 && count3 > 0) ? true : false;
   }
   return true;
 }
Exemplo n.º 2
0
 @Override
 public boolean addAssessmentFiles(List<MultipartFile> files, int assessmentId, String uploader) {
   for (MultipartFile file : files) {
     int fileId = fileService.saveFileAndReturnFileId(file, uploader);
     if (fileId != 0) {
       AssessmentFileCfgDO dO = new AssessmentFileCfgDO();
       dO.setAssessmentId(assessmentId);
       dO.setFileId(fileId);
       int count = assessmentFileCfgDOMapper.insert(dO);
       if (count == 0) {
         return false;
       }
     }
   }
   return true;
 }
Exemplo n.º 3
0
 @Override
 public List<FileDO> getAssessmentFilesById(int assessmentId) {
   return assessmentFileCfgDOMapper.selectFilesByAssessmentId(assessmentId);
 }