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

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 pc.exam.pp.framework.common.pojo.CommonResult;
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.IEducationPaperService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService;
import java.util.List;
@@ -24,8 +26,10 @@ public class EducationPaperSchemeController
{
@Autowired
private IEducationPaperSchemeService educationPaperSchemeService;
@Autowired
private IEducationPaperService educationPaperService;
@Autowired
private IEducationPaperService educationPaperService;
@Autowired
private IEducationPaperTaskService educationPaperTaskService;
/**
* 查询试卷方案列表
*/
@@ -63,10 +67,17 @@ private IEducationPaperService educationPaperService;
public CommonResult add(@RequestBody EducationPaperScheme educationPaperScheme)
{
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
if (strings!=null&&strings.size()>0){
return CommonResult.error(DEMO03_PAPER_TASK_ADD_EXISTS);
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());
if (strings!=null&&strings.size()>0){
return CommonResult.error(DEMO03_PAPER_TASK_ADD_EXISTS);
}
}
return CommonResult.success(educationPaperSchemeService.insertEducationPaperScheme(educationPaperScheme));
}
@@ -86,10 +97,17 @@ private IEducationPaperService educationPaperService;
public CommonResult remove(@PathVariable String schemeIds)
{
EducationPaperScheme educationPaperScheme = educationPaperSchemeService.selectEducationPaperSchemeBySchemeId(schemeIds);
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
if (strings!=null&&strings.size()>0){
return CommonResult.error(DEMO03_PAPER_TASK_DEL_EXISTS);
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());
if (strings!=null&&strings.size()>0){
return CommonResult.error(DEMO03_PAPER_TASK_DEL_EXISTS);
}
}
return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeId(schemeIds));
}
}