|
@@ -254,4 +254,25 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
|
|
return this.count(wrapper)>0;
|
|
return this.count(wrapper)>0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public void groupClear(Long paperId, User user) {
|
|
|
|
+ PaperEntity paper = paperService.getById(paperId);
|
|
|
|
+ if (paper == null) {
|
|
|
|
+ throw new StatusException("未找到试卷结构");
|
|
|
|
+ }
|
|
|
|
+ if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
|
|
|
|
+ throw new StatusException("没有权限");
|
|
|
|
+ }
|
|
|
|
+ clearByPaperId(paperId);
|
|
|
|
+ paperGroupUnitService.clearByPaperId(paperId);
|
|
|
|
+ paper.setGroupFinish(false);
|
|
|
|
+ paperService.updateById(paper);
|
|
|
|
+ }
|
|
|
|
+ private void clearByPaperId(Long paperId) {
|
|
|
|
+ QueryWrapper<PaperGroupEntity> wrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<PaperGroupEntity> lw = wrapper.lambda();
|
|
|
|
+ lw.eq(PaperGroupEntity::getPaperId, paperId);
|
|
|
|
+ this.remove(wrapper);
|
|
|
|
+ }
|
|
}
|
|
}
|