Accept Merge Request #96: (hyc -> master)

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

Created By: @华允传
Accepted By: @华允传
URL: https://g-iswv8783.coding.net/p/education/d/pengchen-exam-java/git/merge/96?initial=true
This commit is contained in:
华允传
2025-05-30 01:42:00 +08:00
committed by Coding

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;
@@ -24,8 +26,10 @@ public class EducationPaperSchemeController
{ {
@Autowired @Autowired
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)
{ {
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
if (strings!=null&&strings.size()>0){ EducationPaperTask educationPaperTask = educationPaperTaskService.selectEducationPaperTaskByTaskId(educationPaperScheme.getTaskId());
return CommonResult.error(DEMO03_PAPER_TASK_ADD_EXISTS); 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)); 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);
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
if (strings!=null&&strings.size()>0){ EducationPaperTask educationPaperTask = educationPaperTaskService.selectEducationPaperTaskByTaskId(educationPaperScheme.getTaskId());
return CommonResult.error(DEMO03_PAPER_TASK_DEL_EXISTS); 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)); return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeId(schemeIds));
} }
} }