【修改】新增、删除判断试卷种类

This commit is contained in:
YOHO\20373
2025-05-30 01:41:18 +08:00
parent 215fc1897a
commit e4595b7277

View File

@@ -4,8 +4,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import pc.exam.pp.framework.common.pojo.CommonResult; import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import pc.exam.pp.module.exam.service.paper.IEducationPaperSchemeService; import pc.exam.pp.module.exam.service.paper.IEducationPaperSchemeService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperService; import pc.exam.pp.module.exam.service.paper.IEducationPaperService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService;
import java.util.List; import java.util.List;
@@ -26,6 +28,8 @@ public class EducationPaperSchemeController
private IEducationPaperSchemeService educationPaperSchemeService; private IEducationPaperSchemeService educationPaperSchemeService;
@Autowired @Autowired
private IEducationPaperService educationPaperService; private IEducationPaperService educationPaperService;
@Autowired
private IEducationPaperTaskService educationPaperTaskService;
/** /**
* 查询试卷方案列表 * 查询试卷方案列表
*/ */
@@ -63,10 +67,17 @@ private IEducationPaperService educationPaperService;
public CommonResult add(@RequestBody EducationPaperScheme educationPaperScheme) public CommonResult add(@RequestBody EducationPaperScheme educationPaperScheme)
{ {
EducationPaperTask educationPaperTask = educationPaperTaskService.selectEducationPaperTaskByTaskId(educationPaperScheme.getTaskId());
String taskType = educationPaperTask.getTaskType();
if ( "0".equals(taskType)||"1".equals(taskType)||"3".equals(taskType)) {
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId()); List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
if (strings!=null&&strings.size()>0){ if (strings!=null&&strings.size()>0){
return CommonResult.error(DEMO03_PAPER_TASK_ADD_EXISTS); return CommonResult.error(DEMO03_PAPER_TASK_ADD_EXISTS);
} }
}
return CommonResult.success(educationPaperSchemeService.insertEducationPaperScheme(educationPaperScheme)); return CommonResult.success(educationPaperSchemeService.insertEducationPaperScheme(educationPaperScheme));
} }
@@ -86,10 +97,17 @@ private IEducationPaperService educationPaperService;
public CommonResult remove(@PathVariable String schemeIds) public CommonResult remove(@PathVariable String schemeIds)
{ {
EducationPaperScheme educationPaperScheme = educationPaperSchemeService.selectEducationPaperSchemeBySchemeId(schemeIds); EducationPaperScheme educationPaperScheme = educationPaperSchemeService.selectEducationPaperSchemeBySchemeId(schemeIds);
EducationPaperTask educationPaperTask = educationPaperTaskService.selectEducationPaperTaskByTaskId(educationPaperScheme.getTaskId());
String taskType = educationPaperTask.getTaskType();
if ( "0".equals(taskType)||"1".equals(taskType)||"3".equals(taskType)){
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId()); List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
if (strings!=null&&strings.size()>0){ if (strings!=null&&strings.size()>0){
return CommonResult.error(DEMO03_PAPER_TASK_DEL_EXISTS); return CommonResult.error(DEMO03_PAPER_TASK_DEL_EXISTS);
} }
}
return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeId(schemeIds)); return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeId(schemeIds));
} }
} }